Code formatting and import organizing

This commit is contained in:
pahimar 2013-09-06 22:47:12 -04:00
parent ffb7b5fbef
commit f07e52a5ee
47 changed files with 708 additions and 706 deletions

View file

@ -65,122 +65,121 @@ import cpw.mods.fml.relauncher.Side;
@NetworkMod(channels = { Reference.CHANNEL_NAME }, clientSideRequired = true, serverSideRequired = false, packetHandler = PacketHandler.class) @NetworkMod(channels = { Reference.CHANNEL_NAME }, clientSideRequired = true, serverSideRequired = false, packetHandler = PacketHandler.class)
public class EquivalentExchange3 { public class EquivalentExchange3 {
@Instance(Reference.MOD_ID) @Instance(Reference.MOD_ID)
public static EquivalentExchange3 instance; public static EquivalentExchange3 instance;
@SidedProxy(clientSide = Reference.CLIENT_PROXY_CLASS, serverSide = Reference.SERVER_PROXY_CLASS) @SidedProxy(clientSide = Reference.CLIENT_PROXY_CLASS, serverSide = Reference.SERVER_PROXY_CLASS)
public static CommonProxy proxy; public static CommonProxy proxy;
public static CreativeTabs tabsEE3 = new CreativeTabEE3(CreativeTabs.getNextID(), Reference.MOD_ID); public static CreativeTabs tabsEE3 = new CreativeTabEE3(CreativeTabs.getNextID(), Reference.MOD_ID);
@EventHandler @EventHandler
public void invalidFingerprint(FMLFingerprintViolationEvent event) { public void invalidFingerprint(FMLFingerprintViolationEvent event) {
// Report (log) to the user that the version of Equivalent Exchange 3 // Report (log) to the user that the version of Equivalent Exchange 3
// they are using has been changed/tampered with // they are using has been changed/tampered with
if (Reference.FINGERPRINT.equals("@FINGERPRINT@")) { if (Reference.FINGERPRINT.equals("@FINGERPRINT@")) {
LogHelper.warning(Strings.NO_FINGERPRINT_MESSAGE); LogHelper.warning(Strings.NO_FINGERPRINT_MESSAGE);
} }
else { else {
LogHelper.severe(Strings.INVALID_FINGERPRINT_MESSAGE); LogHelper.severe(Strings.INVALID_FINGERPRINT_MESSAGE);
} }
} }
@EventHandler @EventHandler
public void serverStarting(FMLServerStartingEvent event) { public void serverStarting(FMLServerStartingEvent event) {
// Initialize the custom commands // Initialize the custom commands
CommandHandler.initCommands(event); CommandHandler.initCommands(event);
} }
@EventHandler @EventHandler
public void preInit(FMLPreInitializationEvent event) { public void preInit(FMLPreInitializationEvent event) {
// Initialize the log helper // Initialize the log helper
LogHelper.init(); LogHelper.init();
// Initialize the configuration // Initialize the configuration
ConfigurationHandler.init(new File(event.getModConfigurationDirectory().getAbsolutePath() + File.separator + Reference.CHANNEL_NAME + File.separator + Reference.MOD_ID + ".cfg")); ConfigurationHandler.init(new File(event.getModConfigurationDirectory().getAbsolutePath() + File.separator + Reference.CHANNEL_NAME + File.separator + Reference.MOD_ID + ".cfg"));
// Conduct the version check and log the result // Conduct the version check and log the result
VersionHelper.execute(); VersionHelper.execute();
// Initialize the Version Check Tick Handler (Client only) // Initialize the Version Check Tick Handler (Client only)
TickRegistry.registerTickHandler(new VersionCheckTickHandler(), TickRegistry.registerTickHandler(new VersionCheckTickHandler(), Side.CLIENT);
Side.CLIENT);
// Initialize the Render Tick Handler (Client only) // Initialize the Render Tick Handler (Client only)
proxy.registerRenderTickHandler(); proxy.registerRenderTickHandler();
// Register the KeyBinding Handler (Client only) // Register the KeyBinding Handler (Client only)
proxy.registerKeyBindingHandler(); proxy.registerKeyBindingHandler();
// Register the Sound Handler (Client only) // Register the Sound Handler (Client only)
proxy.registerSoundHandler(); proxy.registerSoundHandler();
// Initialize mod blocks // Initialize mod blocks
ModBlocks.init(); ModBlocks.init();
// Initialize mod items // Initialize mod items
ModItems.init(); ModItems.init();
} }
@EventHandler @EventHandler
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public void load(FMLInitializationEvent event) { public void load(FMLInitializationEvent event) {
// Register the GUI Handler // Register the GUI Handler
NetworkRegistry.instance().registerGuiHandler(instance, proxy); NetworkRegistry.instance().registerGuiHandler(instance, proxy);
// Register the PlayerDestroyItem Handler // Register the PlayerDestroyItem Handler
MinecraftForge.EVENT_BUS.register(new PlayerDestroyItemHandler()); MinecraftForge.EVENT_BUS.register(new PlayerDestroyItemHandler());
// Register the Item Pickup Handler // Register the Item Pickup Handler
MinecraftForge.EVENT_BUS.register(new ItemEventHandler()); MinecraftForge.EVENT_BUS.register(new ItemEventHandler());
// Register the EntityLiving Handler // Register the EntityLiving Handler
MinecraftForge.EVENT_BUS.register(new EntityLivingHandler()); MinecraftForge.EVENT_BUS.register(new EntityLivingHandler());
MinecraftForge.EVENT_BUS.register(new ActionRequestHandler()); MinecraftForge.EVENT_BUS.register(new ActionRequestHandler());
MinecraftForge.EVENT_BUS.register(new WorldTransmutationHandler()); MinecraftForge.EVENT_BUS.register(new WorldTransmutationHandler());
GameRegistry.registerCraftingHandler(new CraftingHandler()); GameRegistry.registerCraftingHandler(new CraftingHandler());
// Register the DrawBlockHighlight Handler // Register the DrawBlockHighlight Handler
proxy.registerDrawBlockHighlightHandler(); proxy.registerDrawBlockHighlightHandler();
// Initialize mod tile entities // Initialize mod tile entities
proxy.registerTileEntities(); proxy.registerTileEntities();
// Initialize custom rendering and pre-load textures (Client only) // Initialize custom rendering and pre-load textures (Client only)
proxy.initRenderingAndTextures(); proxy.initRenderingAndTextures();
// Add in the ability to dye Alchemical Bags // Add in the ability to dye Alchemical Bags
CraftingManager.getInstance().getRecipeList().add(new RecipesAlchemicalBagDyes()); CraftingManager.getInstance().getRecipeList().add(new RecipesAlchemicalBagDyes());
// Register the Fuel Handler // Register the Fuel Handler
GameRegistry.registerFuelHandler(new FuelHandler()); GameRegistry.registerFuelHandler(new FuelHandler());
// Quick test to see that sending an encoded recipe to be added to the // Quick test to see that sending an encoded recipe to be added to the
// recipe registry works // recipe registry works
FMLInterModComms.sendMessage(Reference.MOD_ID, InterModComms.ADD_RECIPE, NBTHelper.encodeRecipeAsNBT(Item.bucketWater, Arrays.asList(Item.bucketEmpty, Block.waterStill))); FMLInterModComms.sendMessage(Reference.MOD_ID, InterModComms.ADD_RECIPE, NBTHelper.encodeRecipeAsNBT(Item.bucketWater, Arrays.asList(Item.bucketEmpty, Block.waterStill)));
FMLInterModComms.sendMessage(Reference.MOD_ID, InterModComms.ADD_RECIPE, NBTHelper.encodeRecipeAsNBT(Item.bucketLava, Arrays.asList(Item.bucketEmpty, Block.lavaStill))); FMLInterModComms.sendMessage(Reference.MOD_ID, InterModComms.ADD_RECIPE, NBTHelper.encodeRecipeAsNBT(Item.bucketLava, Arrays.asList(Item.bucketEmpty, Block.lavaStill)));
} }
@EventHandler @EventHandler
public void modsLoaded(FMLPostInitializationEvent event) { public void modsLoaded(FMLPostInitializationEvent event) {
// Initialize the Addon Handler // Initialize the Addon Handler
AddonHandler.init(); AddonHandler.init();
// Initialize the DynEMC system // Initialize the DynEMC system
DynEMC dynEMC = DynEMC.getInstance(); DynEMC dynEMC = DynEMC.getInstance();
} }
@EventHandler @EventHandler
public void handleIMCMessages(IMCEvent event) { public void handleIMCMessages(IMCEvent event) {
InterModCommsHandler.processIMCMessages(event); InterModCommsHandler.processIMCMessages(event);
} }
} }

View file

@ -42,16 +42,16 @@ public class BlockAlchemicalChest extends BlockEE {
this.setBlockBounds(0.0625F, 0.0F, 0.0625F, 0.9375F, 0.875F, 0.9375F); this.setBlockBounds(0.0625F, 0.0F, 0.0625F, 0.9375F, 0.875F, 0.9375F);
this.setCreativeTab(EquivalentExchange3.tabsEE3); this.setCreativeTab(EquivalentExchange3.tabsEE3);
} }
@Override @Override
public String getUnlocalizedName() { public String getUnlocalizedName() {
StringBuilder unlocalizedName = new StringBuilder(); StringBuilder unlocalizedName = new StringBuilder();
unlocalizedName.append("tile."); unlocalizedName.append("tile.");
unlocalizedName.append(Strings.RESOURCE_PREFIX); unlocalizedName.append(Strings.RESOURCE_PREFIX);
unlocalizedName.append(Strings.ALCHEMICAL_CHEST_NAME); unlocalizedName.append(Strings.ALCHEMICAL_CHEST_NAME);
return unlocalizedName.toString(); return unlocalizedName.toString();
} }

View file

@ -10,47 +10,47 @@ import com.pahimar.ee3.tileentity.TileAlchemyTable;
public class BlockAlchemyTable extends BlockEE { public class BlockAlchemyTable extends BlockEE {
public BlockAlchemyTable(int id) { public BlockAlchemyTable(int id) {
super(id, Material.iron); super(id, Material.iron);
this.setUnlocalizedName(Strings.ALCHEMY_TABLE_NAME); this.setUnlocalizedName(Strings.ALCHEMY_TABLE_NAME);
this.setCreativeTab(EquivalentExchange3.tabsEE3); this.setCreativeTab(EquivalentExchange3.tabsEE3);
} }
@Override @Override
public String getUnlocalizedName() { public String getUnlocalizedName() {
StringBuilder unlocalizedName = new StringBuilder(); StringBuilder unlocalizedName = new StringBuilder();
unlocalizedName.append("tile."); unlocalizedName.append("tile.");
unlocalizedName.append(Strings.RESOURCE_PREFIX); unlocalizedName.append(Strings.RESOURCE_PREFIX);
unlocalizedName.append(Strings.ALCHEMY_TABLE_NAME); unlocalizedName.append(Strings.ALCHEMY_TABLE_NAME);
return unlocalizedName.toString(); return unlocalizedName.toString();
} }
// TODO Finish getting the rendering nice looking
// @Override
// public boolean renderAsNormalBlock() {
//
// return false;
// }
//
// @Override
// public boolean isOpaqueCube() {
//
// return false;
// }
//
// @Override
// public int getRenderType() {
//
// return RenderIds.alchemyTable;
// }
@Override // TODO Finish getting the rendering nice looking
public TileEntity createNewTileEntity(World world) { // @Override
// public boolean renderAsNormalBlock() {
//
// return false;
// }
//
// @Override
// public boolean isOpaqueCube() {
//
// return false;
// }
//
// @Override
// public int getRenderType() {
//
// return RenderIds.alchemyTable;
// }
return new TileAlchemyTable(); @Override
} public TileEntity createNewTileEntity(World world) {
return new TileAlchemyTable();
}
} }

View file

@ -46,16 +46,16 @@ public class BlockAludelBase extends BlockEE {
this.setBlockBounds(0.0625F, 0.0F, 0.0625F, 0.9375F, 1.0F, 0.9375F); this.setBlockBounds(0.0625F, 0.0F, 0.0625F, 0.9375F, 1.0F, 0.9375F);
this.setHardness(5F); this.setHardness(5F);
} }
@Override @Override
public String getUnlocalizedName() { public String getUnlocalizedName() {
StringBuilder unlocalizedName = new StringBuilder(); StringBuilder unlocalizedName = new StringBuilder();
unlocalizedName.append("tile."); unlocalizedName.append("tile.");
unlocalizedName.append(Strings.RESOURCE_PREFIX); unlocalizedName.append(Strings.RESOURCE_PREFIX);
unlocalizedName.append(Strings.ALUDEL_NAME); unlocalizedName.append(Strings.ALUDEL_NAME);
return unlocalizedName.toString(); return unlocalizedName.toString();
} }

View file

@ -42,16 +42,16 @@ public class BlockCalcinator extends BlockEE {
this.setHardness(5F); this.setHardness(5F);
this.setBlockBounds(0.1F, 0.0F, 0.1F, 0.9F, 1.0F, 0.9F); this.setBlockBounds(0.1F, 0.0F, 0.1F, 0.9F, 1.0F, 0.9F);
} }
@Override @Override
public String getUnlocalizedName() { public String getUnlocalizedName() {
StringBuilder unlocalizedName = new StringBuilder(); StringBuilder unlocalizedName = new StringBuilder();
unlocalizedName.append("tile."); unlocalizedName.append("tile.");
unlocalizedName.append(Strings.RESOURCE_PREFIX); unlocalizedName.append(Strings.RESOURCE_PREFIX);
unlocalizedName.append(Strings.CALCINATOR_NAME); unlocalizedName.append(Strings.CALCINATOR_NAME);
return unlocalizedName.toString(); return unlocalizedName.toString();
} }

View file

@ -37,10 +37,10 @@ public abstract class BlockEE extends BlockContainer {
blockIcon = iconRegister.registerIcon(String.format("%s:%s", Reference.MOD_ID.toLowerCase(), getUnwrappedUnlocalizedName(this.getUnlocalizedName()))); blockIcon = iconRegister.registerIcon(String.format("%s:%s", Reference.MOD_ID.toLowerCase(), getUnwrappedUnlocalizedName(this.getUnlocalizedName())));
} }
protected String getUnwrappedUnlocalizedName(String unlocalizedName) { protected String getUnwrappedUnlocalizedName(String unlocalizedName) {
return unlocalizedName.substring(unlocalizedName.indexOf(":") + 1); return unlocalizedName.substring(unlocalizedName.indexOf(":") + 1);
} }
/** /**

View file

@ -40,16 +40,16 @@ public class BlockGlassBell extends BlockEE {
this.setCreativeTab(EquivalentExchange3.tabsEE3); this.setCreativeTab(EquivalentExchange3.tabsEE3);
this.setHardness(1.0F); this.setHardness(1.0F);
} }
@Override @Override
public String getUnlocalizedName() { public String getUnlocalizedName() {
StringBuilder unlocalizedName = new StringBuilder(); StringBuilder unlocalizedName = new StringBuilder();
unlocalizedName.append("tile."); unlocalizedName.append("tile.");
unlocalizedName.append(Strings.RESOURCE_PREFIX); unlocalizedName.append(Strings.RESOURCE_PREFIX);
unlocalizedName.append(Strings.GLASS_BELL_NAME); unlocalizedName.append(Strings.GLASS_BELL_NAME);
return unlocalizedName.toString(); return unlocalizedName.toString();
} }

View file

@ -25,16 +25,16 @@ public class BlockRedWaterFlowing extends BlockFlowing {
this.setCreativeTab(EquivalentExchange3.tabsEE3); this.setCreativeTab(EquivalentExchange3.tabsEE3);
this.setUnlocalizedName(Strings.RED_WATER_FLOWING_NAME); this.setUnlocalizedName(Strings.RED_WATER_FLOWING_NAME);
} }
@Override @Override
public String getUnlocalizedName() { public String getUnlocalizedName() {
StringBuilder unlocalizedName = new StringBuilder(); StringBuilder unlocalizedName = new StringBuilder();
unlocalizedName.append("tile."); unlocalizedName.append("tile.");
unlocalizedName.append(Strings.RESOURCE_PREFIX); unlocalizedName.append(Strings.RESOURCE_PREFIX);
unlocalizedName.append(Strings.RED_WATER_FLOWING_NAME); unlocalizedName.append(Strings.RED_WATER_FLOWING_NAME);
return unlocalizedName.toString(); return unlocalizedName.toString();
} }
} }

View file

@ -26,16 +26,16 @@ public class BlockRedWaterStill extends BlockStationary {
this.setCreativeTab(EquivalentExchange3.tabsEE3); this.setCreativeTab(EquivalentExchange3.tabsEE3);
this.disableStats(); this.disableStats();
} }
@Override @Override
public String getUnlocalizedName() { public String getUnlocalizedName() {
StringBuilder unlocalizedName = new StringBuilder(); StringBuilder unlocalizedName = new StringBuilder();
unlocalizedName.append("tile."); unlocalizedName.append("tile.");
unlocalizedName.append(Strings.RESOURCE_PREFIX); unlocalizedName.append(Strings.RESOURCE_PREFIX);
unlocalizedName.append(Strings.RED_WATER_STILL_NAME); unlocalizedName.append(Strings.RED_WATER_STILL_NAME);
return unlocalizedName.toString(); return unlocalizedName.toString();
} }
} }

View file

@ -11,27 +11,27 @@ import com.pahimar.ee3.tileentity.TileRenderingTank;
public class BlockRenderingTank extends BlockEE { public class BlockRenderingTank extends BlockEE {
public BlockRenderingTank(int id) { public BlockRenderingTank(int id) {
super(id, Material.anvil); super(id, Material.anvil);
this.setUnlocalizedName(Strings.RENDERING_TANK_NAME); this.setUnlocalizedName(Strings.RENDERING_TANK_NAME);
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 3.0F, 1.0F); this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 3.0F, 1.0F);
this.setCreativeTab(EquivalentExchange3.tabsEE3); this.setCreativeTab(EquivalentExchange3.tabsEE3);
} }
@Override @Override
public String getUnlocalizedName() { public String getUnlocalizedName() {
StringBuilder unlocalizedName = new StringBuilder(); StringBuilder unlocalizedName = new StringBuilder();
unlocalizedName.append("tile."); unlocalizedName.append("tile.");
unlocalizedName.append(Strings.RESOURCE_PREFIX); unlocalizedName.append(Strings.RESOURCE_PREFIX);
unlocalizedName.append(Strings.RENDERING_TANK_NAME); unlocalizedName.append(Strings.RENDERING_TANK_NAME);
return unlocalizedName.toString(); return unlocalizedName.toString();
} }
@Override @Override
public boolean renderAsNormalBlock() { public boolean renderAsNormalBlock() {
return false; return false;
@ -49,10 +49,10 @@ public class BlockRenderingTank extends BlockEE {
return RenderIds.renderingTank; return RenderIds.renderingTank;
} }
@Override @Override
public TileEntity createNewTileEntity(World world) { public TileEntity createNewTileEntity(World world) {
return new TileRenderingTank(); return new TileRenderingTank();
} }
} }

View file

@ -27,52 +27,46 @@ import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public class GuiAlchemicalBag extends GuiContainer { public class GuiAlchemicalBag extends GuiContainer {
public GuiAlchemicalBag(InventoryPlayer inventoryPlayer) { public GuiAlchemicalBag(InventoryPlayer inventoryPlayer) {
super(new ContainerAlchemicalBag(inventoryPlayer)); super(new ContainerAlchemicalBag(inventoryPlayer));
xSize = 248; xSize = 248;
ySize = 186; ySize = 186;
} }
@Override @Override
protected void drawGuiContainerForegroundLayer(int x, int y) { protected void drawGuiContainerForegroundLayer(int x, int y) {
fontRenderer.drawString(StatCollector fontRenderer.drawString(StatCollector.translateToLocal(Strings.CONTAINER_ALCHEMICAL_BAG_NAME), 8, 6, 4210752);
.translateToLocal(Strings.CONTAINER_ALCHEMICAL_BAG_NAME), 8, 6, fontRenderer.drawString(StatCollector.translateToLocal(Strings.CONTAINER_INVENTORY), 44, ySize - 96 + 2, 4210752);
4210752); }
fontRenderer.drawString(
StatCollector.translateToLocal(Strings.CONTAINER_INVENTORY),
44, ySize - 96 + 2, 4210752);
}
@Override @Override
protected void drawGuiContainerBackgroundLayer(float opacity, int x, int y) { protected void drawGuiContainerBackgroundLayer(float opacity, int x, int y) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
// this.mc.getTextureManager().bindTexture(...) // this.mc.getTextureManager().bindTexture(...)
this.mc.getTextureManager().bindTexture(Textures.GUI_ALCHEMICAL_STORAGE); this.mc.getTextureManager().bindTexture(Textures.GUI_ALCHEMICAL_STORAGE);
int xStart = (width - xSize) / 2; int xStart = (width - xSize) / 2;
int yStart = (height - ySize) / 2; int yStart = (height - ySize) / 2;
this.drawTexturedModalRect(xStart, yStart, 0, 0, xSize, ySize); this.drawTexturedModalRect(xStart, yStart, 0, 0, xSize, ySize);
} }
@Override @Override
public void onGuiClosed() { public void onGuiClosed() {
super.onGuiClosed(); super.onGuiClosed();
if (mc.thePlayer != null) { if (mc.thePlayer != null) {
for (ItemStack itemStack : mc.thePlayer.inventory.mainInventory) { for (ItemStack itemStack : mc.thePlayer.inventory.mainInventory) {
if (itemStack != null) { if (itemStack != null) {
if (NBTHelper.hasTag(itemStack, if (NBTHelper.hasTag(itemStack, Strings.NBT_ITEM_ALCHEMICAL_BAG_GUI_OPEN)) {
Strings.NBT_ITEM_ALCHEMICAL_BAG_GUI_OPEN)) { NBTHelper.removeTag(itemStack, Strings.NBT_ITEM_ALCHEMICAL_BAG_GUI_OPEN);
NBTHelper.removeTag(itemStack, }
Strings.NBT_ITEM_ALCHEMICAL_BAG_GUI_OPEN); }
} }
} }
} }
}
}
} }

View file

@ -47,9 +47,9 @@ public class GuiAlchemicalChest extends GuiContainer {
protected void drawGuiContainerBackgroundLayer(float opacity, int x, int y) { protected void drawGuiContainerBackgroundLayer(float opacity, int x, int y) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(Textures.GUI_ALCHEMICAL_STORAGE); this.mc.getTextureManager().bindTexture(Textures.GUI_ALCHEMICAL_STORAGE);
int xStart = (width - xSize) / 2; int xStart = (width - xSize) / 2;
int yStart = (height - ySize) / 2; int yStart = (height - ySize) / 2;
this.drawTexturedModalRect(xStart, yStart, 0, 0, xSize, ySize); this.drawTexturedModalRect(xStart, yStart, 0, 0, xSize, ySize);

View file

@ -12,18 +12,19 @@ import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public class GuiAlchemyTable extends GuiContainer { public class GuiAlchemyTable extends GuiContainer {
private TileAlchemyTable tileAlchemyTable; private TileAlchemyTable tileAlchemyTable;
public GuiAlchemyTable(InventoryPlayer inventoryPlayer, TileAlchemyTable tileAlchemyTable) {
super(new ContainerAlchemyTable(inventoryPlayer, tileAlchemyTable));
this.tileAlchemyTable = tileAlchemyTable;
}
@Override public GuiAlchemyTable(InventoryPlayer inventoryPlayer, TileAlchemyTable tileAlchemyTable) {
protected void drawGuiContainerBackgroundLayer(float f, int i, int j) {
// TODO Auto-generated method stub super(new ContainerAlchemyTable(inventoryPlayer, tileAlchemyTable));
this.tileAlchemyTable = tileAlchemyTable;
} }
@Override
protected void drawGuiContainerBackgroundLayer(float f, int i, int j) {
// TODO Auto-generated method stub
}
} }

View file

@ -47,9 +47,9 @@ public class GuiCalcinator extends GuiContainer {
protected void drawGuiContainerBackgroundLayer(float opacity, int x, int y) { protected void drawGuiContainerBackgroundLayer(float opacity, int x, int y) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(Textures.GUI_CALCINATOR); this.mc.getTextureManager().bindTexture(Textures.GUI_CALCINATOR);
int xStart = (width - xSize) / 2; int xStart = (width - xSize) / 2;
int yStart = (height - ySize) / 2; int yStart = (height - ySize) / 2;
this.drawTexturedModalRect(xStart, yStart, 0, 0, xSize, ySize); this.drawTexturedModalRect(xStart, yStart, 0, 0, xSize, ySize);

View file

@ -3,6 +3,7 @@ package com.pahimar.ee3.client.gui.inventory;
import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.inventory.Container; import net.minecraft.inventory.Container;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
import com.pahimar.ee3.lib.Strings; import com.pahimar.ee3.lib.Strings;

View file

@ -1,8 +1,8 @@
package com.pahimar.ee3.client.model; package com.pahimar.ee3.client.model;
import net.minecraft.client.model.ModelBase;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.model.ModelBase;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public class ModelAlchemyTable extends ModelBase { public class ModelAlchemyTable extends ModelBase {

View file

@ -1,26 +1,26 @@
package com.pahimar.ee3.client.model; package com.pahimar.ee3.client.model;
import com.pahimar.ee3.lib.Models;
import net.minecraftforge.client.model.AdvancedModelLoader; import net.minecraftforge.client.model.AdvancedModelLoader;
import net.minecraftforge.client.model.IModelCustom; import net.minecraftforge.client.model.IModelCustom;
import com.pahimar.ee3.lib.Models;
public class ModelRenderingTank { public class ModelRenderingTank {
private IModelCustom modelRenderingTank; private IModelCustom modelRenderingTank;
public ModelRenderingTank() {
modelRenderingTank = AdvancedModelLoader.loadModel(Models.RENDERING_TANK); public ModelRenderingTank() {
modelRenderingTank = AdvancedModelLoader.loadModel(Models.RENDERING_TANK);
} }
public void render() { public void render() {
modelRenderingTank.renderAll(); modelRenderingTank.renderAll();
} }
public void renderPart(String partName) { public void renderPart(String partName) {
modelRenderingTank.renderPart(partName); modelRenderingTank.renderPart(partName);
} }
} }

View file

@ -1,10 +1,10 @@
package com.pahimar.ee3.client.renderer.item; package com.pahimar.ee3.client.renderer.item;
import org.lwjgl.opengl.GL11;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraftforge.client.IItemRenderer; import net.minecraftforge.client.IItemRenderer;
import org.lwjgl.opengl.GL11;
import com.pahimar.ee3.client.model.ModelRenderingTank; import com.pahimar.ee3.client.model.ModelRenderingTank;
import com.pahimar.ee3.lib.Textures; import com.pahimar.ee3.lib.Textures;
@ -12,51 +12,51 @@ import cpw.mods.fml.client.FMLClientHandler;
public class ItemRenderingTankRenderer implements IItemRenderer { public class ItemRenderingTankRenderer implements IItemRenderer {
private ModelRenderingTank modelRenderingTank; private ModelRenderingTank modelRenderingTank;
public ItemRenderingTankRenderer() {
modelRenderingTank = new ModelRenderingTank(); public ItemRenderingTankRenderer() {
modelRenderingTank = new ModelRenderingTank();
} }
@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
return true; @Override
} public boolean handleRenderType(ItemStack item, ItemRenderType type) {
@Override return true;
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) { }
return true; @Override
} public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
@Override return true;
public void renderItem(ItemRenderType type, ItemStack item, Object... data) { }
switch (type) { @Override
case ENTITY: { public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
renderRenderingTank(-0.5F, -1.2F, 0.5F, 0.75F);
return; switch (type) {
} case ENTITY: {
case EQUIPPED: { renderRenderingTank(-0.5F, -1.2F, 0.5F, 0.75F);
renderRenderingTank(-0.2F, -0.85F, 0.8F, 0.75F); return;
return; }
} case EQUIPPED: {
case EQUIPPED_FIRST_PERSON: { renderRenderingTank(-0.2F, -0.85F, 0.8F, 0.75F);
renderRenderingTank(-0.2F, -0.50F, 0.8F, 0.75F); return;
return; }
} case EQUIPPED_FIRST_PERSON: {
case INVENTORY: { renderRenderingTank(-0.2F, -0.50F, 0.8F, 0.75F);
renderRenderingTank(-1.0F, -2.05F, 0.0F, 0.5F); return;
return; }
} case INVENTORY: {
default: renderRenderingTank(-1.0F, -2.05F, 0.0F, 0.5F);
return; return;
} }
} default:
return;
private void renderRenderingTank(float x, float y, float z, float scale) { }
}
private void renderRenderingTank(float x, float y, float z, float scale) {
GL11.glPushMatrix(); GL11.glPushMatrix();
GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_LIGHTING);

View file

@ -2,6 +2,7 @@ package com.pahimar.ee3.client.renderer.tileentity;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
import com.pahimar.ee3.client.model.ModelCalcinator; import com.pahimar.ee3.client.model.ModelCalcinator;

View file

@ -16,16 +16,16 @@ import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public class TileEntityRenderingTankRenderer extends TileEntitySpecialRenderer { public class TileEntityRenderingTankRenderer extends TileEntitySpecialRenderer {
private ModelRenderingTank modelRenderingTank = new ModelRenderingTank(); private ModelRenderingTank modelRenderingTank = new ModelRenderingTank();
@Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float tick) {
if (tileEntity instanceof TileRenderingTank) { @Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float tick) {
GL11.glDisable(GL11.GL_LIGHTING); if (tileEntity instanceof TileRenderingTank) {
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_CULL_FACE);
GL11.glPushMatrix(); GL11.glPushMatrix();
// Scale, Translate, Rotate // Scale, Translate, Rotate
@ -38,12 +38,12 @@ public class TileEntityRenderingTankRenderer extends TileEntitySpecialRenderer {
// Render // Render
modelRenderingTank.render(); modelRenderingTank.render();
GL11.glPopMatrix(); GL11.glPopMatrix();
GL11.glEnable(GL11.GL_CULL_FACE); GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_LIGHTING);
} }
} }
} }

View file

@ -95,9 +95,10 @@ public class CommandEE extends CommandBase {
throw new WrongUsageException(Commands.COMMAND_EE3_USAGE, new Object[0]); throw new WrongUsageException(Commands.COMMAND_EE3_USAGE, new Object[0]);
} }
@Override @Override
public String getCommandUsage(ICommandSender icommandsender) { public String getCommandUsage(ICommandSender icommandsender) {
// TODO Auto-generated method stub
return null; // TODO Auto-generated method stub
} return null;
}
} }

View file

@ -68,7 +68,7 @@ public class CommandOverlay {
float scale = Float.parseFloat(args[1]); float scale = Float.parseFloat(args[1]);
if (scale <= 0F) { if (scale <= 0F) {
throw new WrongUsageException(Commands.COMMAND_OVERLAY_SCALE_USAGE_ADDITIONAL_TEXT, new Object[] { Commands.COMMAND_OVERLAY_SCALE_USAGE }); throw new WrongUsageException(Commands.COMMAND_OVERLAY_SCALE_USAGE_ADDITIONAL_TEXT, new Object[] { Commands.COMMAND_OVERLAY_SCALE_USAGE });
} }
else { else {
ConfigurationSettings.TARGET_BLOCK_OVERLAY_SCALE = scale; ConfigurationSettings.TARGET_BLOCK_OVERLAY_SCALE = scale;
@ -77,11 +77,11 @@ public class CommandOverlay {
} }
} }
catch (Exception e) { catch (Exception e) {
throw new WrongUsageException(Commands.COMMAND_OVERLAY_SCALE_USAGE_ADDITIONAL_TEXT, new Object[] { Commands.COMMAND_OVERLAY_SCALE_USAGE }); throw new WrongUsageException(Commands.COMMAND_OVERLAY_SCALE_USAGE_ADDITIONAL_TEXT, new Object[] { Commands.COMMAND_OVERLAY_SCALE_USAGE });
} }
} }
else { else {
throw new WrongUsageException(Commands.COMMAND_OVERLAY_SCALE_USAGE_ADDITIONAL_TEXT, new Object[] { Commands.COMMAND_OVERLAY_SCALE_USAGE }); throw new WrongUsageException(Commands.COMMAND_OVERLAY_SCALE_USAGE_ADDITIONAL_TEXT, new Object[] { Commands.COMMAND_OVERLAY_SCALE_USAGE });
} }
} }
@ -101,11 +101,11 @@ public class CommandOverlay {
} }
} }
catch (Exception e) { catch (Exception e) {
throw new WrongUsageException(Commands.COMMAND_OVERLAY_OPACITY_USAGE_ADDITIONAL_TEXT, new Object[] { Commands.COMMAND_OVERLAY_OPACITY_USAGE }); throw new WrongUsageException(Commands.COMMAND_OVERLAY_OPACITY_USAGE_ADDITIONAL_TEXT, new Object[] { Commands.COMMAND_OVERLAY_OPACITY_USAGE });
} }
} }
else else
throw new WrongUsageException(Commands.COMMAND_OVERLAY_OPACITY_USAGE_ADDITIONAL_TEXT, new Object[] { Commands.COMMAND_OVERLAY_OPACITY_USAGE }); throw new WrongUsageException(Commands.COMMAND_OVERLAY_OPACITY_USAGE_ADDITIONAL_TEXT, new Object[] { Commands.COMMAND_OVERLAY_OPACITY_USAGE });
} }
private static void processPositionCommand(ICommandSender commandSender, String[] args) { private static void processPositionCommand(ICommandSender commandSender, String[] args) {

View file

@ -31,11 +31,11 @@ public class ItemUtil {
StringBuilder stringBuilder = new StringBuilder(); StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("ItemStack("); stringBuilder.append("ItemStack(");
if (itemStack != null) { if (itemStack != null) {
stringBuilder.append(String.format("%s", encodeItemStackAsString(itemStack))); stringBuilder.append(String.format("%s", encodeItemStackAsString(itemStack)));
if (itemStack.hasTagCompound()) { if (itemStack.hasTagCompound()) {
stringBuilder.append(String.format("%s%s", Strings.TOKEN_DELIMITER, NBTHelper.encodeNBTAsString((itemStack.getTagCompound())))); stringBuilder.append(String.format("%s%s", Strings.TOKEN_DELIMITER, NBTHelper.encodeNBTAsString((itemStack.getTagCompound()))));
} }
@ -43,7 +43,7 @@ public class ItemUtil {
else { else {
stringBuilder.append("null"); stringBuilder.append("null");
} }
stringBuilder.append(")"); stringBuilder.append(")");
return stringBuilder.toString(); return stringBuilder.toString();
@ -52,54 +52,56 @@ public class ItemUtil {
public static String encodeItemStackAsString(ItemStack itemStack) { public static String encodeItemStackAsString(ItemStack itemStack) {
StringBuilder stringBuilder = new StringBuilder(); StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append(String.format("%s%s%s", itemStack.itemID, Strings.TOKEN_DELIMITER, itemStack.getItemDamage())); stringBuilder.append(String.format("%s%s%s", itemStack.itemID, Strings.TOKEN_DELIMITER, itemStack.getItemDamage()));
return stringBuilder.toString(); return stringBuilder.toString();
} }
public static ItemStack decodeItemStackFromString(String encodedItemStack) { public static ItemStack decodeItemStackFromString(String encodedItemStack) {
ItemStack decodedItemStack = null; ItemStack decodedItemStack = null;
final int UNDEFINED = -1; final int UNDEFINED = -1;
final int ERROR = -2; final int ERROR = -2;
int itemId = UNDEFINED; int itemId = UNDEFINED;
int meta = UNDEFINED; int meta = UNDEFINED;
String[] splitString = encodedItemStack.split(Strings.TOKEN_DELIMITER); String[] splitString = encodedItemStack.split(Strings.TOKEN_DELIMITER);
// Grab itemId // Grab itemId
if (splitString.length >= 1) { if (splitString.length >= 1) {
try { try {
itemId = Integer.parseInt(splitString[0]); itemId = Integer.parseInt(splitString[0]);
} catch (NumberFormatException e) { }
catch (NumberFormatException e) {
itemId = ERROR; itemId = ERROR;
} }
} }
// Grab meta // Grab meta
if (splitString.length >= 2) { if (splitString.length >= 2) {
try { try {
meta = Integer.parseInt(splitString[1]); meta = Integer.parseInt(splitString[1]);
} catch (NumberFormatException e) { }
catch (NumberFormatException e) {
meta = ERROR; meta = ERROR;
} }
} }
if (meta == UNDEFINED) { if (meta == UNDEFINED) {
meta = OreDictionary.WILDCARD_VALUE; meta = OreDictionary.WILDCARD_VALUE;
} }
if (itemId != UNDEFINED && itemId != ERROR) { if (itemId != UNDEFINED && itemId != ERROR) {
if (meta != ERROR) { if (meta != ERROR) {
decodedItemStack = new ItemStack(itemId, 1, meta); decodedItemStack = new ItemStack(itemId, 1, meta);
} }
} }
return decodedItemStack; return decodedItemStack;
} }
@ -168,58 +170,58 @@ public class ItemUtil {
} }
} }
} }
public static Comparator<ItemStack> ItemStackComparator = new Comparator<ItemStack>() { public static Comparator<ItemStack> ItemStackComparator = new Comparator<ItemStack>() {
public int compare(ItemStack itemStack1, ItemStack itemStack2) { public int compare(ItemStack itemStack1, ItemStack itemStack2) {
if (itemStack1 != null && itemStack2 != null) { if (itemStack1 != null && itemStack2 != null) {
// Sort on itemID // Sort on itemID
if (itemStack1.itemID == itemStack2.itemID) { if (itemStack1.itemID == itemStack2.itemID) {
// Then sort on meta // Then sort on meta
if (itemStack1.getItemDamage() == itemStack2.getItemDamage()) { if (itemStack1.getItemDamage() == itemStack2.getItemDamage()) {
// Then sort on NBT // Then sort on NBT
if (itemStack1.hasTagCompound() && itemStack2.hasTagCompound()) { if (itemStack1.hasTagCompound() && itemStack2.hasTagCompound()) {
// Then sort on stack size // Then sort on stack size
if (itemStack1.getTagCompound().equals(itemStack2.getTagCompound())) { if (itemStack1.getTagCompound().equals(itemStack2.getTagCompound())) {
return (itemStack1.stackSize - itemStack2.stackSize); return (itemStack1.stackSize - itemStack2.stackSize);
} }
else { else {
return (itemStack1.getTagCompound().hashCode() - itemStack2.getTagCompound().hashCode()); return (itemStack1.getTagCompound().hashCode() - itemStack2.getTagCompound().hashCode());
} }
} }
else if (!(itemStack1.hasTagCompound()) && itemStack2.hasTagCompound()) { else if (!(itemStack1.hasTagCompound()) && itemStack2.hasTagCompound()) {
return -1; return -1;
} }
else if (itemStack1.hasTagCompound() && !(itemStack2.hasTagCompound())) { else if (itemStack1.hasTagCompound() && !(itemStack2.hasTagCompound())) {
return 1; return 1;
} }
else { else {
return (itemStack1.stackSize - itemStack2.stackSize); return (itemStack1.stackSize - itemStack2.stackSize);
} }
} }
else { else {
return (itemStack1.getItemDamage() - itemStack2.getItemDamage()); return (itemStack1.getItemDamage() - itemStack2.getItemDamage());
} }
} }
else { else {
return (itemStack1.itemID - itemStack2.itemID); return (itemStack1.itemID - itemStack2.itemID);
} }
} }
else if (itemStack1 != null && itemStack2 == null) { else if (itemStack1 != null && itemStack2 == null) {
return -1; return -1;
} }
else if (itemStack1 == null && itemStack2 != null) { else if (itemStack1 == null && itemStack2 != null) {
return 1; return 1;
} }
else { else {
return 0; return 0;
} }
} }
}; };
} }

View file

@ -89,15 +89,15 @@ public class RecipeHelper {
ShapedRecipes shapedRecipe = (ShapedRecipes) recipe; ShapedRecipes shapedRecipe = (ShapedRecipes) recipe;
for (int i = 0; i < shapedRecipe.recipeItems.length; i++) { for (int i = 0; i < shapedRecipe.recipeItems.length; i++) {
if (shapedRecipe.recipeItems[i] instanceof ItemStack) { if (shapedRecipe.recipeItems[i] instanceof ItemStack) {
ItemStack itemStack = shapedRecipe.recipeItems[i].copy(); ItemStack itemStack = shapedRecipe.recipeItems[i].copy();
if (itemStack.stackSize > 1) { if (itemStack.stackSize > 1) {
itemStack.stackSize = 1; itemStack.stackSize = 1;
} }
recipeInputs.add(new CustomWrappedStack(itemStack)); recipeInputs.add(new CustomWrappedStack(itemStack));
} }
} }
@ -107,15 +107,15 @@ public class RecipeHelper {
ShapelessRecipes shapelessRecipe = (ShapelessRecipes) recipe; ShapelessRecipes shapelessRecipe = (ShapelessRecipes) recipe;
for (Object object : shapelessRecipe.recipeItems) { for (Object object : shapelessRecipe.recipeItems) {
if (object instanceof ItemStack) { if (object instanceof ItemStack) {
ItemStack itemStack = ((ItemStack) object).copy(); ItemStack itemStack = ((ItemStack) object).copy();
if (itemStack.stackSize > 1) { if (itemStack.stackSize > 1) {
itemStack.stackSize = 1; itemStack.stackSize = 1;
} }
recipeInputs.add(new CustomWrappedStack(itemStack)); recipeInputs.add(new CustomWrappedStack(itemStack));
} }
} }
@ -125,25 +125,25 @@ public class RecipeHelper {
ShapedOreRecipe shapedOreRecipe = (ShapedOreRecipe) recipe; ShapedOreRecipe shapedOreRecipe = (ShapedOreRecipe) recipe;
for (int i = 0; i < shapedOreRecipe.getInput().length; i++) { for (int i = 0; i < shapedOreRecipe.getInput().length; i++) {
/* /*
* If the element is a list, then it is an OreStack * If the element is a list, then it is an OreStack
*/ */
if (shapedOreRecipe.getInput()[i] instanceof ArrayList) { if (shapedOreRecipe.getInput()[i] instanceof ArrayList) {
CustomWrappedStack oreStack = new CustomWrappedStack(shapedOreRecipe.getInput()[i]); CustomWrappedStack oreStack = new CustomWrappedStack(shapedOreRecipe.getInput()[i]);
if (oreStack.getWrappedStack() instanceof OreStack) { if (oreStack.getWrappedStack() instanceof OreStack) {
recipeInputs.add(new CustomWrappedStack(shapedOreRecipe.getInput()[i])); recipeInputs.add(new CustomWrappedStack(shapedOreRecipe.getInput()[i]));
} }
} }
else if (shapedOreRecipe.getInput()[i] instanceof ItemStack) { else if (shapedOreRecipe.getInput()[i] instanceof ItemStack) {
ItemStack itemStack = ((ItemStack) shapedOreRecipe.getInput()[i]).copy(); ItemStack itemStack = ((ItemStack) shapedOreRecipe.getInput()[i]).copy();
if (itemStack.stackSize > 1) { if (itemStack.stackSize > 1) {
itemStack.stackSize = 1; itemStack.stackSize = 1;
} }
recipeInputs.add(new CustomWrappedStack(itemStack)); recipeInputs.add(new CustomWrappedStack(itemStack));
} }
} }
@ -153,18 +153,18 @@ public class RecipeHelper {
ShapelessOreRecipe shapelessOreRecipe = (ShapelessOreRecipe) recipe; ShapelessOreRecipe shapelessOreRecipe = (ShapelessOreRecipe) recipe;
for (Object object : shapelessOreRecipe.getInput()) { for (Object object : shapelessOreRecipe.getInput()) {
if (object instanceof ArrayList) { if (object instanceof ArrayList) {
recipeInputs.add(new CustomWrappedStack(object)); recipeInputs.add(new CustomWrappedStack(object));
} }
else if (object instanceof ItemStack) { else if (object instanceof ItemStack) {
ItemStack itemStack = ((ItemStack) object).copy(); ItemStack itemStack = ((ItemStack) object).copy();
if (itemStack.stackSize > 1) { if (itemStack.stackSize > 1) {
itemStack.stackSize = 1; itemStack.stackSize = 1;
} }
recipeInputs.add(new CustomWrappedStack(itemStack)); recipeInputs.add(new CustomWrappedStack(itemStack));
} }
} }

View file

@ -1,18 +1,18 @@
package com.pahimar.ee3.core.util; package com.pahimar.ee3.core.util;
import com.pahimar.ee3.lib.Reference;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import com.pahimar.ee3.lib.Reference;
public class ResourceLocationHelper { public class ResourceLocationHelper {
public static ResourceLocation getResourceLocation(String modId, String path) { public static ResourceLocation getResourceLocation(String modId, String path) {
return new ResourceLocation(modId, path);
}
public static ResourceLocation getResourceLocation(String path) {
return getResourceLocation(Reference.MOD_ID.toLowerCase(), path); return new ResourceLocation(modId, path);
} }
public static ResourceLocation getResourceLocation(String path) {
return getResourceLocation(Reference.MOD_ID.toLowerCase(), path);
}
} }

View file

@ -132,7 +132,7 @@ public class VersionHelper implements Runnable {
public static String getResultMessage() { public static String getResultMessage() {
if (result == UNINITIALIZED) { if (result == UNINITIALIZED) {
return StatCollector.translateToLocal(Strings.UNINITIALIZED_MESSAGE); return StatCollector.translateToLocal(Strings.UNINITIALIZED_MESSAGE);
} }
else if (result == CURRENT) { else if (result == CURRENT) {
return StatCollector.translateToLocalFormatted(Strings.CURRENT_MESSAGE, Reference.MOD_NAME, Loader.instance().getMCVersionString()); return StatCollector.translateToLocalFormatted(Strings.CURRENT_MESSAGE, Reference.MOD_NAME, Loader.instance().getMCVersionString());
@ -141,16 +141,16 @@ public class VersionHelper implements Runnable {
return StatCollector.translateToLocalFormatted(Strings.OUTDATED_MESSAGE, Reference.MOD_NAME, remoteVersion, Loader.instance().getMCVersionString(), remoteUpdateLocation); return StatCollector.translateToLocalFormatted(Strings.OUTDATED_MESSAGE, Reference.MOD_NAME, remoteVersion, Loader.instance().getMCVersionString(), remoteUpdateLocation);
} }
else if (result == OUTDATED && remoteVersion != null && remoteUpdateLocation != null) { else if (result == OUTDATED && remoteVersion != null && remoteUpdateLocation != null) {
return StatCollector.translateToLocalFormatted(Strings.OUTDATED_MESSAGE, Reference.MOD_NAME, remoteVersion, Loader.instance().getMCVersionString(), remoteUpdateLocation); return StatCollector.translateToLocalFormatted(Strings.OUTDATED_MESSAGE, Reference.MOD_NAME, remoteVersion, Loader.instance().getMCVersionString(), remoteUpdateLocation);
} }
else if (result == ERROR) { else if (result == ERROR) {
return StatCollector.translateToLocal(Strings.GENERAL_ERROR_MESSAGE); return StatCollector.translateToLocal(Strings.GENERAL_ERROR_MESSAGE);
} }
else if (result == FINAL_ERROR) { else if (result == FINAL_ERROR) {
return StatCollector.translateToLocal(Strings.FINAL_ERROR_MESSAGE); return StatCollector.translateToLocal(Strings.FINAL_ERROR_MESSAGE);
} }
else if (result == MC_VERSION_NOT_FOUND) { else if (result == MC_VERSION_NOT_FOUND) {
return StatCollector.translateToLocalFormatted(Strings.MC_VERSION_NOT_FOUND, Reference.MOD_NAME, Loader.instance().getMCVersionString()); return StatCollector.translateToLocalFormatted(Strings.MC_VERSION_NOT_FOUND, Reference.MOD_NAME, Loader.instance().getMCVersionString());
} }
else { else {
result = ERROR; result = ERROR;
@ -160,11 +160,7 @@ public class VersionHelper implements Runnable {
public static String getResultMessageForClient() { public static String getResultMessageForClient() {
return StatCollector.translateToLocalFormatted(Strings.OUTDATED_MESSAGE, return StatCollector.translateToLocalFormatted(Strings.OUTDATED_MESSAGE, Colours.TEXT_COLOUR_PREFIX_YELLOW + Reference.MOD_NAME + Colours.TEXT_COLOUR_PREFIX_WHITE, Colours.TEXT_COLOUR_PREFIX_YELLOW + VersionHelper.remoteVersion + Colours.TEXT_COLOUR_PREFIX_WHITE, Colours.TEXT_COLOUR_PREFIX_YELLOW + Loader.instance().getMCVersionString() + Colours.TEXT_COLOUR_PREFIX_WHITE, Colours.TEXT_COLOUR_PREFIX_YELLOW + VersionHelper.remoteUpdateLocation + Colours.TEXT_COLOUR_PREFIX_WHITE);
Colours.TEXT_COLOUR_PREFIX_YELLOW + Reference.MOD_NAME + Colours.TEXT_COLOUR_PREFIX_WHITE,
Colours.TEXT_COLOUR_PREFIX_YELLOW + VersionHelper.remoteVersion + Colours.TEXT_COLOUR_PREFIX_WHITE,
Colours.TEXT_COLOUR_PREFIX_YELLOW + Loader.instance().getMCVersionString() + Colours.TEXT_COLOUR_PREFIX_WHITE,
Colours.TEXT_COLOUR_PREFIX_YELLOW + VersionHelper.remoteUpdateLocation + Colours.TEXT_COLOUR_PREFIX_WHITE);
} }
public static byte getResult() { public static byte getResult() {

View file

@ -18,19 +18,19 @@ import cpw.mods.fml.relauncher.SideOnly;
*/ */
public class CreativeTabEE3 extends CreativeTabs { public class CreativeTabEE3 extends CreativeTabs {
public CreativeTabEE3(int tabID, String tabLabel) { public CreativeTabEE3(int tabID, String tabLabel) {
super(tabID, tabLabel); super(tabID, tabLabel);
} }
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
/** /**
* the itemID for the item to be displayed on the tab * the itemID for the item to be displayed on the tab
*/ */
public int getTabIconItemIndex() { public int getTabIconItemIndex() {
return ItemIds.MINIUM_SHARD; return ItemIds.MINIUM_SHARD;
} }
} }

View file

@ -15,7 +15,7 @@ import com.pahimar.ee3.item.crafting.RecipeRegistry;
public class DynEMC { public class DynEMC {
private static DynEMC dynEMC = null; private static DynEMC dynEMC = null;
private RecipeRegistry recipeRegistry; private RecipeRegistry recipeRegistry;
private WeightedDirectedGraph<CustomWrappedStack> graph; private WeightedDirectedGraph<CustomWrappedStack> graph;
@ -37,60 +37,61 @@ public class DynEMC {
} }
private void init() { private void init() {
populateGraph(); populateGraph();
} }
private void populateGraph() { private void populateGraph() {
for (CustomWrappedStack discoveredStack : recipeRegistry.getDiscoveredStacks()) { for (CustomWrappedStack discoveredStack : recipeRegistry.getDiscoveredStacks()) {
graph.addNode(discoveredStack); graph.addNode(discoveredStack);
} }
Multimap<CustomWrappedStack, List<CustomWrappedStack>> recipeMappings = recipeRegistry.getRecipeMappings(); Multimap<CustomWrappedStack, List<CustomWrappedStack>> recipeMappings = recipeRegistry.getRecipeMappings();
Set<CustomWrappedStack> recipeKeySet = recipeMappings.keySet(); Set<CustomWrappedStack> recipeKeySet = recipeMappings.keySet();
Iterator<CustomWrappedStack> recipeKeySetIterator = recipeKeySet.iterator(); Iterator<CustomWrappedStack> recipeKeySetIterator = recipeKeySet.iterator();
CustomWrappedStack recipeOutput = null; CustomWrappedStack recipeOutput = null;
while (recipeKeySetIterator.hasNext()) { while (recipeKeySetIterator.hasNext()) {
recipeOutput = recipeKeySetIterator.next(); recipeOutput = recipeKeySetIterator.next();
for (List<CustomWrappedStack> recipeInputs : recipeMappings.get(recipeOutput)) { for (List<CustomWrappedStack> recipeInputs : recipeMappings.get(recipeOutput)) {
CustomWrappedStack unWrappedRecipeOutput = new CustomWrappedStack(recipeOutput.getWrappedStack()); CustomWrappedStack unWrappedRecipeOutput = new CustomWrappedStack(recipeOutput.getWrappedStack());
if (graph.nodeExists(unWrappedRecipeOutput)) { if (graph.nodeExists(unWrappedRecipeOutput)) {
for (CustomWrappedStack recipeInput : recipeInputs) { for (CustomWrappedStack recipeInput : recipeInputs) {
// Unwrapped the wrapped stacks so that we actually find them in the graph // Unwrapped the wrapped stacks so that we actually find them in the graph
CustomWrappedStack unWrappedRecipeInput = new CustomWrappedStack(recipeInput.getWrappedStack()); CustomWrappedStack unWrappedRecipeInput = new CustomWrappedStack(recipeInput.getWrappedStack());
if (graph.nodeExists(unWrappedRecipeInput)) { if (graph.nodeExists(unWrappedRecipeInput)) {
if (recipeOutput.getStackSize() != 0) { if (recipeOutput.getStackSize() != 0) {
try { try {
graph.addEdge(unWrappedRecipeOutput, unWrappedRecipeInput, (recipeInput.getStackSize() * 1.0f) / recipeOutput.getStackSize()); graph.addEdge(unWrappedRecipeOutput, unWrappedRecipeInput, (recipeInput.getStackSize() * 1.0f) / recipeOutput.getStackSize());
} catch (NoSuchElementException e) { }
LogHelper.severe(e.getLocalizedMessage()); catch (NoSuchElementException e) {
} LogHelper.severe(e.getLocalizedMessage());
} }
} }
else { }
LogHelper.debug("Recipe output '" + unWrappedRecipeOutput.toString() + "' exists in the crafting relationship graph"); else {
LogHelper.debug("Recipe input '" + unWrappedRecipeInput.toString() + "' does not exist in the crafting relationship graph"); LogHelper.debug("Recipe output '" + unWrappedRecipeOutput.toString() + "' exists in the crafting relationship graph");
} LogHelper.debug("Recipe input '" + unWrappedRecipeInput.toString() + "' does not exist in the crafting relationship graph");
} }
} }
else { }
LogHelper.debug("Recipe output '" + unWrappedRecipeOutput.toString() + "' does not exist in the crafting relationship graph"); else {
} LogHelper.debug("Recipe output '" + unWrappedRecipeOutput.toString() + "' does not exist in the crafting relationship graph");
}
} }
} }
} }
public List<CustomWrappedStack> getCriticalNodes() { public List<CustomWrappedStack> getCriticalNodes() {
return graph.getCriticalNodes(); return graph.getCriticalNodes();
} }
@ -104,12 +105,12 @@ public class DynEMC {
LogHelper.debug("Total node count: " + graph.getAllNodes().size()); LogHelper.debug("Total node count: " + graph.getAllNodes().size());
LogHelper.debug("Critical node count: " + graph.getCriticalNodes().size()); LogHelper.debug("Critical node count: " + graph.getCriticalNodes().size());
LogHelper.debug("Orphan node count: " + graph.getOrphanNodes().size()); LogHelper.debug("Orphan node count: " + graph.getOrphanNodes().size());
List<CustomWrappedStack> critsMinusOrphans = graph.getCriticalNodes(); List<CustomWrappedStack> critsMinusOrphans = graph.getCriticalNodes();
critsMinusOrphans.removeAll(graph.getOrphanNodes()); critsMinusOrphans.removeAll(graph.getOrphanNodes());
LogHelper.debug("[Critical - Orphans] node count: " + critsMinusOrphans.size()); LogHelper.debug("[Critical - Orphans] node count: " + critsMinusOrphans.size());
LogHelper.debug("***** START NODES *****"); LogHelper.debug("***** START NODES *****");
Iterator<CustomWrappedStack> nodeIter = graph.iterator(); Iterator<CustomWrappedStack> nodeIter = graph.iterator();
while (nodeIter.hasNext()) { while (nodeIter.hasNext()) {

View file

@ -35,12 +35,12 @@ public class EmcBlackList {
public boolean add(Object object) { public boolean add(Object object) {
boolean wasAdded = false; boolean wasAdded = false;
if (CustomWrappedStack.canBeWrapped(object)) { if (CustomWrappedStack.canBeWrapped(object)) {
CustomWrappedStack wrappedStack = new CustomWrappedStack(object); CustomWrappedStack wrappedStack = new CustomWrappedStack(object);
wrappedStack.setStackSize(1); wrappedStack.setStackSize(1);
if (!stackBlackList.contains(wrappedStack)) { if (!stackBlackList.contains(wrappedStack)) {
stackBlackList.add(wrappedStack); stackBlackList.add(wrappedStack);
wasAdded = true; wasAdded = true;
@ -53,10 +53,10 @@ public class EmcBlackList {
public boolean contains(Object object) { public boolean contains(Object object) {
if (CustomWrappedStack.canBeWrapped(object)) { if (CustomWrappedStack.canBeWrapped(object)) {
CustomWrappedStack wrappedStack = new CustomWrappedStack(object); CustomWrappedStack wrappedStack = new CustomWrappedStack(object);
wrappedStack.setStackSize(1); wrappedStack.setStackSize(1);
return stackBlackList.contains(wrappedStack); return stackBlackList.contains(wrappedStack);
} }
@ -66,12 +66,12 @@ public class EmcBlackList {
public boolean remove(Object object) { public boolean remove(Object object) {
boolean wasRemoved = false; boolean wasRemoved = false;
if (CustomWrappedStack.canBeWrapped(object)) { if (CustomWrappedStack.canBeWrapped(object)) {
CustomWrappedStack wrappedStack = new CustomWrappedStack(object); CustomWrappedStack wrappedStack = new CustomWrappedStack(object);
wrappedStack.setStackSize(1); wrappedStack.setStackSize(1);
if (stackBlackList.contains(wrappedStack)) { if (stackBlackList.contains(wrappedStack)) {
stackBlackList.remove(wrappedStack); stackBlackList.remove(wrappedStack);
wasRemoved = true; wasRemoved = true;

View file

@ -43,19 +43,19 @@ public class EmcComponent implements Comparable<EmcComponent> {
return stringBuilder.toString(); return stringBuilder.toString();
} }
@Override @Override
public int compareTo(EmcComponent emcComponent) { public int compareTo(EmcComponent emcComponent) {
if (emcComponent != null) { if (emcComponent != null) {
if (this.type == emcComponent.type) { if (this.type == emcComponent.type) {
return (this.ratioWeight - emcComponent.ratioWeight); return (this.ratioWeight - emcComponent.ratioWeight);
} }
else { else {
return this.type.compareTo(emcComponent.type); return this.type.compareTo(emcComponent.type);
} }
} }
else { else {
return 1; return 1;
} }
} }
} }

View file

@ -9,29 +9,29 @@ import com.pahimar.ee3.item.CustomWrappedStack;
public class EmcRegistry { public class EmcRegistry {
private static EmcRegistry emcRegistry = null; private static EmcRegistry emcRegistry = null;
private Map<CustomWrappedStack, EmcValue> stackMappings;
private TreeMap<EmcValue, List<CustomWrappedStack>> valueMappings;
private EmcRegistry() { private Map<CustomWrappedStack, EmcValue> stackMappings;
private TreeMap<EmcValue, List<CustomWrappedStack>> valueMappings;
stackMappings = new HashMap<CustomWrappedStack, EmcValue>(); private EmcRegistry() {
valueMappings = new TreeMap<EmcValue, List<CustomWrappedStack>>();
}
public static EmcRegistry getInstance() { stackMappings = new HashMap<CustomWrappedStack, EmcValue>();
valueMappings = new TreeMap<EmcValue, List<CustomWrappedStack>>();
}
if (emcRegistry == null) { public static EmcRegistry getInstance() {
emcRegistry = new EmcRegistry();
emcRegistry.init();
}
return emcRegistry; if (emcRegistry == null) {
} emcRegistry = new EmcRegistry();
emcRegistry.init();
}
private void init() { return emcRegistry;
}
} private void init() {
}
} }

View file

@ -1,11 +1,5 @@
package com.pahimar.ee3.emc; package com.pahimar.ee3.emc;
public enum EmcType { public enum EmcType {
OMNI, OMNI, CORPOREAL, KINETIC, TEMPORAL, ESSENTIA, AMORPHOUS, VOID;
CORPOREAL,
KINETIC,
TEMPORAL,
ESSENTIA,
AMORPHOUS,
VOID;
} }

View file

@ -18,7 +18,7 @@ import com.pahimar.ee3.lib.Strings;
*/ */
public class EmcValue implements Comparable<EmcValue> { public class EmcValue implements Comparable<EmcValue> {
public final float value; public final float value;
public final float recoveryPercent; public final float recoveryPercent;
private final List<EmcComponent> components; private final List<EmcComponent> components;
@ -33,10 +33,10 @@ public class EmcValue implements Comparable<EmcValue> {
} }
public EmcValue(float value, float recoveryPercent) { public EmcValue(float value, float recoveryPercent) {
this(value, recoveryPercent, new ArrayList<EmcComponent>()); this(value, recoveryPercent, new ArrayList<EmcComponent>());
} }
public EmcValue(float value, List<EmcComponent> components) { public EmcValue(float value, List<EmcComponent> components) {
this(value, 1F, collateComponents(components)); this(value, 1F, collateComponents(components));
@ -50,10 +50,10 @@ public class EmcValue implements Comparable<EmcValue> {
} }
public List<EmcComponent> getComponents() { public List<EmcComponent> getComponents() {
return components; return components;
} }
public EmcComponent getComponentByType(EmcType type) { public EmcComponent getComponentByType(EmcType type) {
EmcComponent[] componentArray = (EmcComponent[]) components.toArray(); EmcComponent[] componentArray = (EmcComponent[]) components.toArray();
@ -77,25 +77,25 @@ public class EmcValue implements Comparable<EmcValue> {
public String toString() { public String toString() {
StringBuilder stringBuilder = new StringBuilder(); StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append(String.format("V:%s%sRP:%s%s[", value, Strings.TOKEN_DELIMITER, recoveryPercent, Strings.TOKEN_DELIMITER)); stringBuilder.append(String.format("V:%s%sRP:%s%s[", value, Strings.TOKEN_DELIMITER, recoveryPercent, Strings.TOKEN_DELIMITER));
List<EmcComponent> componentArray = this.components; List<EmcComponent> componentArray = this.components;
Collections.sort(componentArray); Collections.sort(componentArray);
int i = 0; int i = 0;
for (EmcComponent component : componentArray) { for (EmcComponent component : componentArray) {
stringBuilder.append(String.format("%s:%s", component.getType(), component.getRatioWeight())); stringBuilder.append(String.format("%s:%s", component.getType(), component.getRatioWeight()));
i++; i++;
if (i < componentArray.size()) { if (i < componentArray.size()) {
stringBuilder.append(String.format("%s", Strings.TOKEN_DELIMITER)); stringBuilder.append(String.format("%s", Strings.TOKEN_DELIMITER));
} }
} }
stringBuilder.append("]"); stringBuilder.append("]");
return stringBuilder.toString(); return stringBuilder.toString();
@ -113,42 +113,42 @@ public class EmcValue implements Comparable<EmcValue> {
return hashCode; return hashCode;
} }
@Override @Override
public int compareTo(EmcValue emcValue) { public int compareTo(EmcValue emcValue) {
if (Float.compare(this.value, emcValue.value) == 0) { if (Float.compare(this.value, emcValue.value) == 0) {
if (Float.compare(this.recoveryPercent, emcValue.recoveryPercent) == 0) { if (Float.compare(this.recoveryPercent, emcValue.recoveryPercent) == 0) {
return (this.components.hashCode() - emcValue.components.hashCode()); return (this.components.hashCode() - emcValue.components.hashCode());
} }
else { else {
return Float.compare(this.recoveryPercent, emcValue.recoveryPercent); return Float.compare(this.recoveryPercent, emcValue.recoveryPercent);
} }
} }
else { else {
return Float.compare(this.value, emcValue.value); return Float.compare(this.value, emcValue.value);
} }
} }
private static List<EmcComponent> collateComponents(List<EmcComponent> uncollatedComponents) { private static List<EmcComponent> collateComponents(List<EmcComponent> uncollatedComponents) {
Integer[] componentCount = new Integer[7]; Integer[] componentCount = new Integer[7];
for (EmcComponent emcComponent : uncollatedComponents) { for (EmcComponent emcComponent : uncollatedComponents) {
if (componentCount[emcComponent.getType().ordinal()] == null) { if (componentCount[emcComponent.getType().ordinal()] == null) {
componentCount[emcComponent.getType().ordinal()] = new Integer(0); componentCount[emcComponent.getType().ordinal()] = new Integer(0);
} }
componentCount[emcComponent.getType().ordinal()] = new Integer(componentCount[emcComponent.getType().ordinal()].intValue() + emcComponent.getRatioWeight()); componentCount[emcComponent.getType().ordinal()] = new Integer(componentCount[emcComponent.getType().ordinal()].intValue() + emcComponent.getRatioWeight());
} }
List<EmcComponent> collatedComponents = new ArrayList<EmcComponent>(); List<EmcComponent> collatedComponents = new ArrayList<EmcComponent>();
for (int i = 0; i < 7; i++) { for (int i = 0; i < 7; i++) {
if (componentCount[i] != null) { if (componentCount[i] != null) {
collatedComponents.add(new EmcComponent(EmcType.values()[i], componentCount[i].intValue())); collatedComponents.add(new EmcComponent(EmcType.values()[i], componentCount[i].intValue()));
} }
} }
return collatedComponents; return collatedComponents;
} }
} }

View file

@ -52,7 +52,7 @@ public class WeightedDirectedGraph<T> implements Iterable<T> {
LogHelper.severe("To node: " + to.toString()); LogHelper.severe("To node: " + to.toString());
} }
if (!graph.containsKey(to)) { if (!graph.containsKey(to)) {
LogHelper.severe("From node: " + from.toString()); LogHelper.severe("From node: " + from.toString());
LogHelper.severe("To node doesn't exist: " + to.toString()); LogHelper.severe("To node doesn't exist: " + to.toString());
} }
throw new NoSuchElementException("Missing nodes from graph"); throw new NoSuchElementException("Missing nodes from graph");

View file

@ -8,17 +8,18 @@ import com.pahimar.ee3.tileentity.TileAlchemyTable;
public class ContainerAlchemyTable extends Container { public class ContainerAlchemyTable extends Container {
private TileAlchemyTable tileAlchemyTable; private TileAlchemyTable tileAlchemyTable;
public ContainerAlchemyTable(InventoryPlayer inventoryPlayer, TileAlchemyTable tileAlchemyTable) { public ContainerAlchemyTable(InventoryPlayer inventoryPlayer, TileAlchemyTable tileAlchemyTable) {
this.tileAlchemyTable = tileAlchemyTable; this.tileAlchemyTable = tileAlchemyTable;
} }
@Override @Override
public boolean canInteractWith(EntityPlayer entityplayer) { public boolean canInteractWith(EntityPlayer entityplayer) {
// TODO Auto-generated method stub
return false; // TODO Auto-generated method stub
} return false;
}
} }

View file

@ -5,11 +5,11 @@ import com.pahimar.ee3.lib.Strings;
public class ItemAlchemicalChalk extends ItemEE { public class ItemAlchemicalChalk extends ItemEE {
public ItemAlchemicalChalk(int id) { public ItemAlchemicalChalk(int id) {
super(id); super(id);
this.setUnlocalizedName(Strings.RESOURCE_PREFIX + Strings.ALCHEMICAL_CHALK_NAME); this.setUnlocalizedName(Strings.RESOURCE_PREFIX + Strings.ALCHEMICAL_CHALK_NAME);
this.setCreativeTab(EquivalentExchange3.tabsEE3); this.setCreativeTab(EquivalentExchange3.tabsEE3);
} }
} }

View file

@ -42,14 +42,14 @@ public class ItemAlchemicalDust extends ItemEE {
@Override @Override
public String getUnlocalizedName(ItemStack itemStack) { public String getUnlocalizedName(ItemStack itemStack) {
StringBuilder unlocalizedName = new StringBuilder(); StringBuilder unlocalizedName = new StringBuilder();
int meta = MathHelper.clamp_int(itemStack.getItemDamage(), 0, 5); int meta = MathHelper.clamp_int(itemStack.getItemDamage(), 0, 5);
unlocalizedName.append("item."); unlocalizedName.append("item.");
unlocalizedName.append(Strings.RESOURCE_PREFIX); unlocalizedName.append(Strings.RESOURCE_PREFIX);
unlocalizedName.append(Strings.ALCHEMICAL_DUST_NAME); unlocalizedName.append(Strings.ALCHEMICAL_DUST_NAME);
unlocalizedName.append(ALCHEMICAL_DUST_NAMES[meta]); unlocalizedName.append(ALCHEMICAL_DUST_NAMES[meta]);
return unlocalizedName.toString(); return unlocalizedName.toString();
} }

View file

@ -43,7 +43,7 @@ public class ModItems {
philStone.setContainerItem(philStone); philStone.setContainerItem(philStone);
// TODO Register items with the GameRegistry // TODO Register items with the GameRegistry
GameRegistry.addRecipe(new ItemStack(inertStone), new Object[] { "sis", "igi", "sis", Character.valueOf('s'), Block.stone, Character.valueOf('i'), Item.ingotIron, Character.valueOf('g'), Item.ingotGold }); GameRegistry.addRecipe(new ItemStack(inertStone), new Object[] { "sis", "igi", "sis", Character.valueOf('s'), Block.stone, Character.valueOf('i'), Item.ingotIron, Character.valueOf('g'), Item.ingotGold });
GameRegistry.addRecipe(new ItemStack(miniumStone), new Object[] { "sss", "sis", "sss", Character.valueOf('s'), miniumShard, Character.valueOf('i'), inertStone }); GameRegistry.addRecipe(new ItemStack(miniumStone), new Object[] { "sss", "sis", "sss", Character.valueOf('s'), miniumShard, Character.valueOf('i'), inertStone });

View file

@ -43,9 +43,9 @@ public class RecipeRegistry {
return recipeRegistry; return recipeRegistry;
} }
private void init() { private void init() {
Multimap<CustomWrappedStack, List<CustomWrappedStack>> recipes = HashMultimap.create(); Multimap<CustomWrappedStack, List<CustomWrappedStack>> recipes = HashMultimap.create();
// Add potion recipes // Add potion recipes
@ -62,7 +62,7 @@ public class RecipeRegistry {
// Populate the discovered stacks list with all stacks that we are involved in a recipe we are aware of // Populate the discovered stacks list with all stacks that we are involved in a recipe we are aware of
discoverStacks(recipes); discoverStacks(recipes);
// Add items that have no recipe, using the list of discovered stacks to determine if it's in a recipe or not // Add items that have no recipe, using the list of discovered stacks to determine if it's in a recipe or not
for (CustomWrappedStack stack : recipelessStacks) { for (CustomWrappedStack stack : recipelessStacks) {
recipes.put(stack, new ArrayList<CustomWrappedStack>()); recipes.put(stack, new ArrayList<CustomWrappedStack>());
@ -75,32 +75,32 @@ public class RecipeRegistry {
while (recipeKeySetIterator.hasNext()) { while (recipeKeySetIterator.hasNext()) {
recipeOutput = recipeKeySetIterator.next(); recipeOutput = recipeKeySetIterator.next();
for (List<CustomWrappedStack> recipeInputs : recipes.get(recipeOutput)) { for (List<CustomWrappedStack> recipeInputs : recipes.get(recipeOutput)) {
addRecipe(recipeOutput, recipeInputs); addRecipe(recipeOutput, recipeInputs);
} }
} }
} }
private void discoverStacks(Multimap<CustomWrappedStack, List<CustomWrappedStack>> recipes) { private void discoverStacks(Multimap<CustomWrappedStack, List<CustomWrappedStack>> recipes) {
Set<CustomWrappedStack> recipeKeySet = recipes.keySet(); Set<CustomWrappedStack> recipeKeySet = recipes.keySet();
Iterator<CustomWrappedStack> recipeKeySetIterator = recipeKeySet.iterator(); Iterator<CustomWrappedStack> recipeKeySetIterator = recipeKeySet.iterator();
CustomWrappedStack recipeOutput = null; CustomWrappedStack recipeOutput = null;
// Discover all stacks involved in the recipes we know about // Discover all stacks involved in the recipes we know about
while (recipeKeySetIterator.hasNext()) { while (recipeKeySetIterator.hasNext()) {
recipeOutput = recipeKeySetIterator.next(); recipeOutput = recipeKeySetIterator.next();
if (!discoveredStacks.contains(new CustomWrappedStack(recipeOutput.getWrappedStack())) && recipeOutput.getWrappedStack() != null) { if (!discoveredStacks.contains(new CustomWrappedStack(recipeOutput.getWrappedStack())) && recipeOutput.getWrappedStack() != null) {
discoveredStacks.add(new CustomWrappedStack(recipeOutput.getWrappedStack())); discoveredStacks.add(new CustomWrappedStack(recipeOutput.getWrappedStack()));
} }
for (List<CustomWrappedStack> recipeInputs : recipes.get(recipeOutput)) { for (List<CustomWrappedStack> recipeInputs : recipes.get(recipeOutput)) {
for (CustomWrappedStack recipeInput : recipeInputs) { for (CustomWrappedStack recipeInput : recipeInputs) {
CustomWrappedStack unwrappedRecipeInput = new CustomWrappedStack(recipeInput.getWrappedStack()); CustomWrappedStack unwrappedRecipeInput = new CustomWrappedStack(recipeInput.getWrappedStack());
if (!discoveredStacks.contains(unwrappedRecipeInput) && recipeInput.getWrappedStack() != null) { if (!discoveredStacks.contains(unwrappedRecipeInput) && recipeInput.getWrappedStack() != null) {
discoveredStacks.add(unwrappedRecipeInput); discoveredStacks.add(unwrappedRecipeInput);
} }
@ -109,41 +109,41 @@ public class RecipeRegistry {
} }
CustomWrappedStack customWrappedStack; CustomWrappedStack customWrappedStack;
// Discover all stacks from the vanilla Items array // Discover all stacks from the vanilla Items array
for (int i = 0; i < Item.itemsList.length; i++) { for (int i = 0; i < Item.itemsList.length; i++) {
if (Item.itemsList[i] != null) { if (Item.itemsList[i] != null) {
if (Item.itemsList[i].getHasSubtypes()) { if (Item.itemsList[i].getHasSubtypes()) {
for (int meta = 0; meta < 16; meta++) { for (int meta = 0; meta < 16; meta++) {
customWrappedStack = new CustomWrappedStack(new ItemStack(Item.itemsList[i].itemID, 1, meta)); customWrappedStack = new CustomWrappedStack(new ItemStack(Item.itemsList[i].itemID, 1, meta));
if (!discoveredStacks.contains(customWrappedStack)) { if (!discoveredStacks.contains(customWrappedStack)) {
discoveredStacks.add(customWrappedStack); discoveredStacks.add(customWrappedStack);
} }
} }
} }
else { else {
customWrappedStack = new CustomWrappedStack(new ItemStack(Item.itemsList[i])); customWrappedStack = new CustomWrappedStack(new ItemStack(Item.itemsList[i]));
if (!discoveredStacks.contains(customWrappedStack)) { if (!discoveredStacks.contains(customWrappedStack)) {
discoveredStacks.add(customWrappedStack); discoveredStacks.add(customWrappedStack);
} }
} }
} }
} }
/* /*
* For every stack we have discovered, check to see if we know a recipe for it. If we don't * For every stack we have discovered, check to see if we know a recipe
* and we haven't already added it to the recipeless stack list, add it to the recipeless stack * for it. If we don't and we haven't already added it to the recipeless
* list * stack list, add it to the recipeless stack list
*/ */
for (CustomWrappedStack discoveredStack : discoveredStacks) { for (CustomWrappedStack discoveredStack : discoveredStacks) {
if (recipes.get(discoveredStack).size() == 0 && !recipelessStacks.contains(discoveredStack)) { if (recipes.get(discoveredStack).size() == 0 && !recipelessStacks.contains(discoveredStack)) {
recipelessStacks.add(discoveredStack); recipelessStacks.add(discoveredStack);
} }
@ -278,24 +278,24 @@ public class RecipeRegistry {
return stringBuilder.toString(); return stringBuilder.toString();
} }
public Multimap<CustomWrappedStack, List<CustomWrappedStack>> getRecipeMappings() { public Multimap<CustomWrappedStack, List<CustomWrappedStack>> getRecipeMappings() {
return recipeMap; return recipeMap;
} }
public List<CustomWrappedStack> getDiscoveredStacks() { public List<CustomWrappedStack> getDiscoveredStacks() {
return discoveredStacks; return discoveredStacks;
} }
public List<CustomWrappedStack> getRecipelessStacks() { public List<CustomWrappedStack> getRecipelessStacks() {
return recipelessStacks; return recipelessStacks;
} }
public List<CustomWrappedStack> getWildCardStacks() { public List<CustomWrappedStack> getWildCardStacks() {
return wildCardStacks; return wildCardStacks;
} }
} }

View file

@ -39,7 +39,7 @@ public class RecipesVanilla {
ItemStack recipeOutput = recipe.getRecipeOutput(); ItemStack recipeOutput = recipe.getRecipeOutput();
if (recipeOutput != null) { if (recipeOutput != null) {
ArrayList<CustomWrappedStack> recipeInputs = RecipeHelper.getRecipeInputs(recipe); ArrayList<CustomWrappedStack> recipeInputs = RecipeHelper.getRecipeInputs(recipe);
vanillaRecipes.put(new CustomWrappedStack(recipeOutput), recipeInputs); vanillaRecipes.put(new CustomWrappedStack(recipeOutput), recipeInputs);
} }

View file

@ -4,11 +4,11 @@ public class InterModComms {
// Interacting with the Recipe Registry // Interacting with the Recipe Registry
public static final String ADD_RECIPE = "add-recipe"; public static final String ADD_RECIPE = "add-recipe";
// Interacting with the EMC BlackList // Interacting with the EMC BlackList
public static final String ADD_BLACKLIST_ENTRY = "add-blacklist-entry"; public static final String ADD_BLACKLIST_ENTRY = "add-blacklist-entry";
public static final String REMOVE_BLACKLIST_ENTRY = "remove-blacklist-entry"; public static final String REMOVE_BLACKLIST_ENTRY = "remove-blacklist-entry";
// Interacting with the EMC value mappings // Interacting with the EMC value mappings
public static final String SET_EMC_VALUE = "set-emc-value"; public static final String SET_EMC_VALUE = "set-emc-value";
} }

View file

@ -10,5 +10,5 @@ public class Models {
public static final String GLASS_BELL = MODEL_LOCATION + "aludel.obj"; public static final String GLASS_BELL = MODEL_LOCATION + "aludel.obj";
public static final String ALCHEMY_TABLE = MODEL_LOCATION + "alchemyTable.obj"; public static final String ALCHEMY_TABLE = MODEL_LOCATION + "alchemyTable.obj";
public static final String RENDERING_TANK = MODEL_LOCATION + "renderingTank.obj"; public static final String RENDERING_TANK = MODEL_LOCATION + "renderingTank.obj";
} }

View file

@ -17,5 +17,5 @@ public class RenderIds {
public static int glassBell; public static int glassBell;
public static int alchemyTable; public static int alchemyTable;
public static int renderingTank; public static int renderingTank;
} }

View file

@ -15,7 +15,7 @@ public class Strings {
public static final String TRUE = "true"; public static final String TRUE = "true";
public static final String FALSE = "false"; public static final String FALSE = "false";
public static final String TOKEN_DELIMITER = ","; public static final String TOKEN_DELIMITER = ",";
/* Localization Prefixes */ /* Localization Prefixes */
public static final String RESOURCE_PREFIX = Reference.MOD_ID.toLowerCase() + ":"; public static final String RESOURCE_PREFIX = Reference.MOD_ID.toLowerCase() + ":";

View file

@ -39,20 +39,20 @@ public class NBTHelper {
/** /**
* Encodes the given NBT object as a String * Encodes the given NBT object as a String
* @param nbtBase *
* @param nbtBase
* @return String encoding of the given NBT object * @return String encoding of the given NBT object
*/ */
public static String encodeNBTAsString(NBTBase nbtBase) { public static String encodeNBTAsString(NBTBase nbtBase) {
StringBuilder stringBuilder = new StringBuilder(); StringBuilder stringBuilder = new StringBuilder();
if (nbtBase != null) { if (nbtBase != null) {
// Encode the name of the tag, and the type of the tag // Encode the name of the tag, and the type of the tag
stringBuilder.append(String.format("'%s':%s:", nbtBase.getName(), NBTBase.getTagName(nbtBase.getId()))); stringBuilder.append(String.format("'%s':%s:", nbtBase.getName(), NBTBase.getTagName(nbtBase.getId())));
// Encode the value of the tag, depending on the type of the tag // Encode the value of the tag, depending on the type of the tag
switch (nbtBase.getId()) switch (nbtBase.getId()) {
{
case 0: { case 0: {
stringBuilder.append(((NBTTagEnd) nbtBase).toString()); stringBuilder.append(((NBTTagEnd) nbtBase).toString());
break; break;
@ -83,19 +83,19 @@ public class NBTHelper {
} }
case 7: { case 7: {
NBTTagByteArray byteArray = (NBTTagByteArray) nbtBase; NBTTagByteArray byteArray = (NBTTagByteArray) nbtBase;
stringBuilder.append("["); stringBuilder.append("[");
for (int i = 0; i < byteArray.byteArray.length; i++) { for (int i = 0; i < byteArray.byteArray.length; i++) {
stringBuilder.append(byteArray.byteArray[i]); stringBuilder.append(byteArray.byteArray[i]);
if (i < byteArray.byteArray.length - 1) { if (i < byteArray.byteArray.length - 1) {
stringBuilder.append("|"); stringBuilder.append("|");
} }
} }
stringBuilder.append("]"); stringBuilder.append("]");
break; break;
} }
case 8: { case 8: {
@ -104,63 +104,63 @@ public class NBTHelper {
} }
case 9: { case 9: {
NBTTagList tagList = (NBTTagList) nbtBase; NBTTagList tagList = (NBTTagList) nbtBase;
stringBuilder.append("["); stringBuilder.append("[");
for (int i = 0; i < tagList.tagCount(); i++) { for (int i = 0; i < tagList.tagCount(); i++) {
Object tagObject = tagList.tagAt(i); Object tagObject = tagList.tagAt(i);
if (tagObject instanceof NBTBase) { if (tagObject instanceof NBTBase) {
stringBuilder.append(encodeNBTAsString((NBTBase) tagObject)); stringBuilder.append(encodeNBTAsString((NBTBase) tagObject));
} }
if (i < tagList.tagCount() - 1) { if (i < tagList.tagCount() - 1) {
stringBuilder.append("|"); stringBuilder.append("|");
} }
} }
stringBuilder.append("]"); stringBuilder.append("]");
break; break;
} }
case 10: { case 10: {
NBTTagCompound tagCompound = (NBTTagCompound) nbtBase; NBTTagCompound tagCompound = (NBTTagCompound) nbtBase;
stringBuilder.append("["); stringBuilder.append("[");
Iterator<?> tagIterator = tagCompound.getTags().iterator(); Iterator<?> tagIterator = tagCompound.getTags().iterator();
while (tagIterator.hasNext()) { while (tagIterator.hasNext()) {
Object tagObject = tagIterator.next(); Object tagObject = tagIterator.next();
if (tagObject instanceof NBTBase) { if (tagObject instanceof NBTBase) {
stringBuilder.append(encodeNBTAsString((NBTBase) tagObject)); stringBuilder.append(encodeNBTAsString((NBTBase) tagObject));
} }
if (tagIterator.hasNext()) { if (tagIterator.hasNext()) {
stringBuilder.append("|"); stringBuilder.append("|");
} }
} }
stringBuilder.append("]"); stringBuilder.append("]");
break; break;
} }
case 11: { case 11: {
NBTTagIntArray intArray = (NBTTagIntArray) nbtBase; NBTTagIntArray intArray = (NBTTagIntArray) nbtBase;
stringBuilder.append("["); stringBuilder.append("[");
for (int i = 0; i < intArray.intArray.length; i++) { for (int i = 0; i < intArray.intArray.length; i++) {
stringBuilder.append(intArray.intArray[i]); stringBuilder.append(intArray.intArray[i]);
if (i < intArray.intArray.length - 1) { if (i < intArray.intArray.length - 1) {
stringBuilder.append("|"); stringBuilder.append("|");
} }
} }
stringBuilder.append("]"); stringBuilder.append("]");
break; break;
} }
default: { default: {
@ -169,10 +169,10 @@ public class NBTHelper {
} }
} }
} }
return stringBuilder.toString(); return stringBuilder.toString();
} }
// TODO Link this method to some API stuffs // TODO Link this method to some API stuffs
public static NBTTagCompound encodeStackAsNBT(Object stackObject) { public static NBTTagCompound encodeStackAsNBT(Object stackObject) {
@ -184,9 +184,9 @@ public class NBTHelper {
NBTTagCompound encodedStack = new NBTTagCompound(name); NBTTagCompound encodedStack = new NBTTagCompound(name);
if (CustomWrappedStack.canBeWrapped(object)) { if (CustomWrappedStack.canBeWrapped(object)) {
CustomWrappedStack wrappedStack = new CustomWrappedStack(object); CustomWrappedStack wrappedStack = new CustomWrappedStack(object);
if (wrappedStack.getWrappedStack() instanceof ItemStack) { if (wrappedStack.getWrappedStack() instanceof ItemStack) {
ItemStack itemStack = (ItemStack) wrappedStack.getWrappedStack(); ItemStack itemStack = (ItemStack) wrappedStack.getWrappedStack();

View file

@ -5,74 +5,85 @@ import net.minecraft.item.ItemStack;
public class TileAlchemyTable extends TileEE implements IInventory { public class TileAlchemyTable extends TileEE implements IInventory {
public TileAlchemyTable() { public TileAlchemyTable() {
}
@Override
public int getSizeInventory() {
// TODO Auto-generated method stub
return 0;
}
@Override }
public ItemStack getStackInSlot(int slotIndex) {
// TODO Auto-generated method stub
return null;
}
@Override @Override
public ItemStack decrStackSize(int slotIndex, int decrementAmount) { public int getSizeInventory() {
// TODO Auto-generated method stub
return null;
}
@Override // TODO Auto-generated method stub
public ItemStack getStackInSlotOnClosing(int slotIndex) { return 0;
// TODO Auto-generated method stub }
return null;
}
@Override @Override
public void setInventorySlotContents(int slotIndex, ItemStack itemstack) { public ItemStack getStackInSlot(int slotIndex) {
// TODO Auto-generated method stub
}
@Override // TODO Auto-generated method stub
public String getInvName() { return null;
// TODO Auto-generated method stub }
return null;
}
@Override @Override
public boolean isInvNameLocalized() { public ItemStack decrStackSize(int slotIndex, int decrementAmount) {
// TODO Auto-generated method stub
return false;
}
@Override // TODO Auto-generated method stub
public int getInventoryStackLimit() { return null;
// TODO Auto-generated method stub }
return 0;
}
@Override @Override
public void openChest() { public ItemStack getStackInSlotOnClosing(int slotIndex) {
// TODO Auto-generated method stub
}
@Override // TODO Auto-generated method stub
public void closeChest() { return null;
// TODO Auto-generated method stub }
}
@Override @Override
public boolean isItemValidForSlot(int slotIndex, ItemStack itemstack) { public void setInventorySlotContents(int slotIndex, ItemStack itemstack) {
// TODO Auto-generated method stub
return false; // TODO Auto-generated method stub
}
}
@Override
public String getInvName() {
// TODO Auto-generated method stub
return null;
}
@Override
public boolean isInvNameLocalized() {
// TODO Auto-generated method stub
return false;
}
@Override
public int getInventoryStackLimit() {
// TODO Auto-generated method stub
return 0;
}
@Override
public void openChest() {
// TODO Auto-generated method stub
}
@Override
public void closeChest() {
// TODO Auto-generated method stub
}
@Override
public boolean isItemValidForSlot(int slotIndex, ItemStack itemstack) {
// TODO Auto-generated method stub
return false;
}
} }

View file

@ -2,7 +2,7 @@ package com.pahimar.ee3.tileentity;
public class TileRenderingTank extends TileEE { public class TileRenderingTank extends TileEE {
public TileRenderingTank() { public TileRenderingTank() {
} }
} }