diff --git a/src/main/java/com/pahimar/ee3/EquivalentExchange3.java b/src/main/java/com/pahimar/ee3/EquivalentExchange3.java
index d9befd33..07d4d7b2 100644
--- a/src/main/java/com/pahimar/ee3/EquivalentExchange3.java
+++ b/src/main/java/com/pahimar/ee3/EquivalentExchange3.java
@@ -15,6 +15,7 @@ import com.pahimar.ee3.lib.Reference;
import com.pahimar.ee3.lib.Strings;
import com.pahimar.ee3.network.PacketHandler;
import com.pahimar.ee3.proxy.IProxy;
+import com.pahimar.ee3.recipe.RecipesAludel;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
@@ -159,6 +160,7 @@ public class EquivalentExchange3
public void postInit(FMLPostInitializationEvent event)
{
// NOOP
+ RecipesAludel.getInstance().debugDumpMap();
}
@EventHandler
diff --git a/src/main/java/com/pahimar/ee3/block/BlockAludelBase.java b/src/main/java/com/pahimar/ee3/block/BlockAludelBase.java
index 24eae468..0dbc1b99 100644
--- a/src/main/java/com/pahimar/ee3/block/BlockAludelBase.java
+++ b/src/main/java/com/pahimar/ee3/block/BlockAludelBase.java
@@ -2,6 +2,7 @@ package com.pahimar.ee3.block;
import com.pahimar.ee3.EquivalentExchange3;
import com.pahimar.ee3.lib.GuiIds;
+import com.pahimar.ee3.lib.Particles;
import com.pahimar.ee3.lib.RenderIds;
import com.pahimar.ee3.lib.Strings;
import com.pahimar.ee3.tileentity.TileAludel;
@@ -16,6 +17,8 @@ import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection;
+import java.util.Random;
+
/**
* Equivalent-Exchange-3
*
@@ -59,6 +62,14 @@ public class BlockAludelBase extends BlockEE implements ITileEntityProvider
return RenderIds.aludelRender;
}
+ @Override
+ public boolean onBlockEventReceived(World par1World, int par2, int par3, int par4, int par5, int par6)
+ {
+ super.onBlockEventReceived(par1World, par2, par3, par4, par5, par6);
+ TileEntity tileentity = par1World.getBlockTileEntity(par2, par3, par4);
+ return tileentity != null ? tileentity.receiveClientEvent(par5, par6) : false;
+ }
+
@Override
public void breakBlock(World world, int x, int y, int z, int id, int meta)
{
@@ -126,7 +137,31 @@ public class BlockAludelBase extends BlockEE implements ITileEntityProvider
@Override
public int getLightValue(IBlockAccess world, int x, int y, int z)
{
- // TODO Vary light levels depending on if we are burning or not
- return 0;
+ if (world.getBlockTileEntity(x, y, z) instanceof TileAludel)
+ {
+ if (((TileAludel) world.getBlockTileEntity(x, y, z)).getState() == 1)
+ {
+ return 15;
+ }
+ }
+
+ return super.getLightValue(world, x, y, z);
+ }
+
+ @Override
+ public void randomDisplayTick(World world, int x, int y, int z, Random random)
+ {
+ if (world.getBlockTileEntity(x, y, z) instanceof TileAludel)
+ {
+ if (((TileAludel) world.getBlockTileEntity(x, y, z)).getState() == 1)
+ {
+ world.spawnParticle(Particles.FLAME, (double) x + 0.175F, (double) y + 0.33F, (double) z + 0.5F, 0.0D, 0.0D, 0.0D);
+
+ world.spawnParticle(Particles.NORMAL_SMOKE, (double) x + 0.5F, (double) y + 0.7F, (double) z + 0.0F, 0.0D, 0.05D, 0.0D);
+ world.spawnParticle(Particles.NORMAL_SMOKE, (double) x + 0.5F, (double) y + 0.7F, (double) z + 1.0F, 0.0D, 0.05D, 0.0D);
+ world.spawnParticle(Particles.NORMAL_SMOKE, (double) x + 0.0F, (double) y + 0.7F, (double) z + 0.5F, 0.0D, 0.05D, 0.0D);
+ world.spawnParticle(Particles.NORMAL_SMOKE, (double) x + 1.0F, (double) y + 0.7F, (double) z + 0.5F, 0.0D, 0.05D, 0.0D);
+ }
+ }
}
}
diff --git a/src/main/java/com/pahimar/ee3/block/BlockCalcinator.java b/src/main/java/com/pahimar/ee3/block/BlockCalcinator.java
index e2bd35ca..1b4ce453 100644
--- a/src/main/java/com/pahimar/ee3/block/BlockCalcinator.java
+++ b/src/main/java/com/pahimar/ee3/block/BlockCalcinator.java
@@ -109,12 +109,8 @@ public class BlockCalcinator extends BlockEE implements ITileEntityProvider
if (((TileCalcinator) world.getBlockTileEntity(x, y, z)).getState() == 1)
{
// Fire pot particles
- // TODO TileEntity.onClientEvent to update particles
world.spawnParticle(Particles.NORMAL_SMOKE, (double) x + 0.5F, (double) y + 0.4F, (double) ((z + 0.5F) + (random.nextFloat() * 0.5F - 0.3F)), 0.0D, 0.0D, 0.0D);
world.spawnParticle(Particles.FLAME, (double) x + 0.5F, (double) y + 0.4F, (double) z + 0.5F, 0.0D, 0.0D, 0.0D);
-
- // Bowl particle effects
- // TODO Decide if the bowl should have particle effects
}
}
}
diff --git a/src/main/java/com/pahimar/ee3/client/gui/inventory/GuiAludel.java b/src/main/java/com/pahimar/ee3/client/gui/inventory/GuiAludel.java
index e46f87d3..72f72d08 100644
--- a/src/main/java/com/pahimar/ee3/client/gui/inventory/GuiAludel.java
+++ b/src/main/java/com/pahimar/ee3/client/gui/inventory/GuiAludel.java
@@ -21,12 +21,10 @@ import org.lwjgl.opengl.GL11;
@SideOnly(Side.CLIENT)
public class GuiAludel extends GuiContainer
{
-
private TileAludel tileAludel;
public GuiAludel(InventoryPlayer inventoryPlayer, TileAludel tileAludel)
{
-
super(new ContainerAludel(inventoryPlayer, tileAludel));
this.tileAludel = tileAludel;
xSize = 176;
@@ -36,7 +34,6 @@ public class GuiAludel extends GuiContainer
@Override
protected void drawGuiContainerForegroundLayer(int x, int y)
{
-
String containerName = tileAludel.isInvNameLocalized() ? tileAludel.getInvName() : StatCollector.translateToLocal(tileAludel.getInvName());
fontRenderer.drawString(containerName, xSize / 2 - fontRenderer.getStringWidth(containerName) / 2, 6, 4210752);
fontRenderer.drawString(StatCollector.translateToLocal(Strings.CONTAINER_INVENTORY), 8, ySize - 93, 4210752);
@@ -45,11 +42,22 @@ public class GuiAludel extends GuiContainer
@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_ALUDEL);
+
int xStart = (width - xSize) / 2;
int yStart = (height - ySize) / 2;
this.drawTexturedModalRect(xStart, yStart, 0, 0, xSize, ySize);
+ int scaleAdjustment;
+
+ if (this.tileAludel.getState() == 1)
+ {
+ scaleAdjustment = this.tileAludel.getBurnTimeRemainingScaled(12);
+ this.drawTexturedModalRect(xStart + 45, yStart + 36 + 34 - scaleAdjustment, 176, 12 - scaleAdjustment, 14, scaleAdjustment + 2);
+ }
+
+ scaleAdjustment = this.tileAludel.getCookProgressScaled(24);
+ this.drawTexturedModalRect(xStart + 76, yStart + 39, 176, 14, scaleAdjustment + 1, 16);
}
}
diff --git a/src/main/java/com/pahimar/ee3/client/renderer/tileentity/TileEntityAludelRenderer.java b/src/main/java/com/pahimar/ee3/client/renderer/tileentity/TileEntityAludelRenderer.java
index 3f116eeb..b5b41bd7 100644
--- a/src/main/java/com/pahimar/ee3/client/renderer/tileentity/TileEntityAludelRenderer.java
+++ b/src/main/java/com/pahimar/ee3/client/renderer/tileentity/TileEntityAludelRenderer.java
@@ -100,7 +100,6 @@ public class TileEntityAludelRenderer extends TileEntitySpecialRenderer
private void scaleTranslateRotate(double x, double y, double z, ForgeDirection orientation)
{
-
if (orientation == ForgeDirection.NORTH)
{
GL11.glTranslated(x + 1, y, z);
@@ -129,7 +128,6 @@ public class TileEntityAludelRenderer extends TileEntitySpecialRenderer
private float getGhostItemScaleFactor(ItemStack itemStack)
{
-
float scaleFactor = 1.0F;
if (itemStack != null)
diff --git a/src/main/java/com/pahimar/ee3/inventory/ContainerAludel.java b/src/main/java/com/pahimar/ee3/inventory/ContainerAludel.java
index efb5f041..6e061e5a 100644
--- a/src/main/java/com/pahimar/ee3/inventory/ContainerAludel.java
+++ b/src/main/java/com/pahimar/ee3/inventory/ContainerAludel.java
@@ -2,9 +2,12 @@ package com.pahimar.ee3.inventory;
import com.pahimar.ee3.item.ItemAlchemicalDust;
import com.pahimar.ee3.tileentity.TileAludel;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
+import net.minecraft.inventory.ICrafting;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntityFurnace;
@@ -18,12 +21,16 @@ import net.minecraft.tileentity.TileEntityFurnace;
*/
public class ContainerAludel extends Container
{
-
+ private TileAludel tileAludel;
private final int PLAYER_INVENTORY_ROWS = 3;
private final int PLAYER_INVENTORY_COLUMNS = 9;
+ private int lastDeviceCookTime;
+ private int lastFuelBurnTime;
+ private int lastItemCookTime;
public ContainerAludel(InventoryPlayer inventoryPlayer, TileAludel tileAludel)
{
+ this.tileAludel = tileAludel;
this.addSlotToContainer(new Slot(tileAludel, TileAludel.FUEL_INVENTORY_INDEX, 44, 74));
this.addSlotToContainer(new Slot(tileAludel, TileAludel.INPUT_INVENTORY_INDEX, 44, 18));
@@ -49,20 +56,17 @@ public class ContainerAludel extends Container
@Override
public boolean canInteractWith(EntityPlayer var1)
{
-
return true;
}
@Override
public ItemStack transferStackInSlot(EntityPlayer entityPlayer, int slotIndex)
{
-
ItemStack itemStack = null;
Slot slot = (Slot) inventorySlots.get(slotIndex);
if (slot != null && slot.getHasStack())
{
-
ItemStack slotItemStack = slot.getStack();
itemStack = slotItemStack.copy();
@@ -73,7 +77,6 @@ public class ContainerAludel extends Container
*/
if (slotIndex < TileAludel.INVENTORY_SIZE)
{
-
if (!this.mergeItemStack(slotItemStack, TileAludel.INVENTORY_SIZE, inventorySlots.size(), false))
{
return null;
@@ -81,7 +84,6 @@ public class ContainerAludel extends Container
}
else
{
-
/**
* If the stack being shift-clicked into the Aludel's container
* is a fuel, first try to put it in the fuel slot. If it cannot
@@ -131,4 +133,62 @@ public class ContainerAludel extends Container
return itemStack;
}
+
+ @Override
+ public void addCraftingToCrafters(ICrafting iCrafting)
+ {
+ super.addCraftingToCrafters(iCrafting);
+ iCrafting.sendProgressBarUpdate(this, 0, this.tileAludel.deviceCookTime);
+ iCrafting.sendProgressBarUpdate(this, 1, this.tileAludel.fuelBurnTime);
+ iCrafting.sendProgressBarUpdate(this, 2, this.tileAludel.itemCookTime);
+ }
+
+ @Override
+ public void detectAndSendChanges()
+ {
+ super.detectAndSendChanges();
+
+ for (Object crafter : this.crafters)
+ {
+ ICrafting icrafting = (ICrafting) crafter;
+
+ if (this.lastDeviceCookTime != this.tileAludel.deviceCookTime)
+ {
+ icrafting.sendProgressBarUpdate(this, 0, this.tileAludel.deviceCookTime);
+ }
+
+ if (this.lastFuelBurnTime != this.tileAludel.fuelBurnTime)
+ {
+ icrafting.sendProgressBarUpdate(this, 1, this.tileAludel.fuelBurnTime);
+ }
+
+ if (this.lastItemCookTime != this.tileAludel.itemCookTime)
+ {
+ icrafting.sendProgressBarUpdate(this, 2, this.tileAludel.itemCookTime);
+ }
+ }
+
+ this.lastDeviceCookTime = this.tileAludel.deviceCookTime;
+ this.lastFuelBurnTime = this.tileAludel.fuelBurnTime;
+ this.lastItemCookTime = this.tileAludel.itemCookTime;
+ }
+
+ @SideOnly(Side.CLIENT)
+ public void updateProgressBar(int valueType, int updatedValue)
+ {
+ if (valueType == 0)
+ {
+ this.tileAludel.deviceCookTime = updatedValue;
+ }
+
+ if (valueType == 1)
+ {
+ this.tileAludel.fuelBurnTime = updatedValue;
+ }
+
+ if (valueType == 2)
+ {
+ this.tileAludel.itemCookTime = updatedValue;
+ }
+ }
}
diff --git a/src/main/java/com/pahimar/ee3/item/crafting/RecipeAludel.java b/src/main/java/com/pahimar/ee3/item/crafting/RecipeAludel.java
new file mode 100644
index 00000000..fe05dc35
--- /dev/null
+++ b/src/main/java/com/pahimar/ee3/item/crafting/RecipeAludel.java
@@ -0,0 +1,32 @@
+package com.pahimar.ee3.item.crafting;
+
+import net.minecraft.item.ItemStack;
+
+import java.util.List;
+
+public class RecipeAludel
+{
+ private ItemStack recipeOutput;
+ private List recipeInputs;
+
+ public RecipeAludel(ItemStack recipeOutput, List recipeInputs)
+ {
+ this.recipeOutput = recipeOutput;
+ this.recipeInputs = recipeInputs;
+ }
+
+ public boolean matches(RecipeAludel recipeAludel)
+ {
+ return false;
+ }
+
+ public ItemStack getRecipeOutput()
+ {
+ return this.recipeOutput;
+ }
+
+ public List getRecipeInputs()
+ {
+ return this.recipeInputs;
+ }
+}
diff --git a/src/main/java/com/pahimar/ee3/lib/Textures.java b/src/main/java/com/pahimar/ee3/lib/Textures.java
index bedf8469..bbdbc14e 100644
--- a/src/main/java/com/pahimar/ee3/lib/Textures.java
+++ b/src/main/java/com/pahimar/ee3/lib/Textures.java
@@ -29,19 +29,19 @@ public class Textures
// GUI textures
public static final ResourceLocation GUI_CALCINATOR = ResourceLocationHelper.getResourceLocation(GUI_SHEET_LOCATION + "calcinator.png");
public static final ResourceLocation GUI_ALUDEL = ResourceLocationHelper.getResourceLocation(GUI_SHEET_LOCATION + "aludel.png");
- public static final ResourceLocation GUI_ALCHEMICAL_STORAGE_SMALL = ResourceLocationHelper.getResourceLocation(GUI_SHEET_LOCATION + "alchemicalStorage_Small.png");
- public static final ResourceLocation GUI_ALCHEMICAL_STORAGE_MEDIUM = ResourceLocationHelper.getResourceLocation(GUI_SHEET_LOCATION + "alchemicalStorage_Medium.png");
- public static final ResourceLocation GUI_ALCHEMICAL_STORAGE_LARGE = ResourceLocationHelper.getResourceLocation(GUI_SHEET_LOCATION + "alchemicalStorage_Large.png");
+ public static final ResourceLocation GUI_ALCHEMICAL_STORAGE_SMALL = ResourceLocationHelper.getResourceLocation(GUI_SHEET_LOCATION + "alchemicalStorage_small.png");
+ public static final ResourceLocation GUI_ALCHEMICAL_STORAGE_MEDIUM = ResourceLocationHelper.getResourceLocation(GUI_SHEET_LOCATION + "alchemicalStorage_medium.png");
+ public static final ResourceLocation GUI_ALCHEMICAL_STORAGE_LARGE = ResourceLocationHelper.getResourceLocation(GUI_SHEET_LOCATION + "alchemicalStorage_large.png");
public static final ResourceLocation GUI_PORTABLE_CRAFTING = new ResourceLocation("textures/gui/container/crafting_table.png");
public static final ResourceLocation GUI_GLASS_BELL = ResourceLocationHelper.getResourceLocation(GUI_SHEET_LOCATION + "glassBell.png");
// Model textures
- public static final ResourceLocation MODEL_CALCINATOR_IDLE = ResourceLocationHelper.getResourceLocation(MODEL_TEXTURE_LOCATION + "calcinator.png");
- public static final ResourceLocation MODEL_CALCINATOR_ACTIVE = ResourceLocationHelper.getResourceLocation(MODEL_TEXTURE_LOCATION + "calcinator_Active.png");
+ public static final ResourceLocation MODEL_CALCINATOR_IDLE = ResourceLocationHelper.getResourceLocation(MODEL_TEXTURE_LOCATION + "calcinator_idle.png");
+ public static final ResourceLocation MODEL_CALCINATOR_ACTIVE = ResourceLocationHelper.getResourceLocation(MODEL_TEXTURE_LOCATION + "calcinator_active.png");
public static final ResourceLocation MODEL_ALUDEL = ResourceLocationHelper.getResourceLocation(MODEL_TEXTURE_LOCATION + "aludel.png");
- public static final ResourceLocation MODEL_ALCHEMICAL_CHEST_SMALL = ResourceLocationHelper.getResourceLocation(MODEL_TEXTURE_LOCATION + "alchemicalChest_Small.png");
- public static final ResourceLocation MODEL_ALCHEMICAL_CHEST_MEDIUM = ResourceLocationHelper.getResourceLocation(MODEL_TEXTURE_LOCATION + "alchemicalChest_Medium.png");
- public static final ResourceLocation MODEL_ALCHEMICAL_CHEST_LARGE = ResourceLocationHelper.getResourceLocation(MODEL_TEXTURE_LOCATION + "alchemicalChest_Large.png");
+ public static final ResourceLocation MODEL_ALCHEMICAL_CHEST_SMALL = ResourceLocationHelper.getResourceLocation(MODEL_TEXTURE_LOCATION + "alchemicalChest_small.png");
+ public static final ResourceLocation MODEL_ALCHEMICAL_CHEST_MEDIUM = ResourceLocationHelper.getResourceLocation(MODEL_TEXTURE_LOCATION + "alchemicalChest_medium.png");
+ public static final ResourceLocation MODEL_ALCHEMICAL_CHEST_LARGE = ResourceLocationHelper.getResourceLocation(MODEL_TEXTURE_LOCATION + "alchemicalChest_large.png");
public static final ResourceLocation MODEL_GLASS_BELL = ResourceLocationHelper.getResourceLocation(MODEL_TEXTURE_LOCATION + "aludel.png");
public static final ResourceLocation MODEL_RESEARCH_STATION = ResourceLocationHelper.getResourceLocation(MODEL_TEXTURE_LOCATION + "researchStation.png");
diff --git a/src/main/java/com/pahimar/ee3/recipe/AludelRecipeInputPair.java b/src/main/java/com/pahimar/ee3/recipe/AludelRecipeInputPair.java
index 5819291e..1d966c61 100644
--- a/src/main/java/com/pahimar/ee3/recipe/AludelRecipeInputPair.java
+++ b/src/main/java/com/pahimar/ee3/recipe/AludelRecipeInputPair.java
@@ -1,9 +1,10 @@
package com.pahimar.ee3.recipe;
-import com.pahimar.ee3.api.OreStack;
import com.pahimar.ee3.helper.ItemHelper;
+import com.pahimar.ee3.helper.LogHelper;
import com.pahimar.ee3.item.ItemAlchemicalDust;
import net.minecraft.item.ItemStack;
+import net.minecraftforge.oredict.OreDictionary;
public class AludelRecipeInputPair
{
@@ -19,7 +20,28 @@ public class AludelRecipeInputPair
@Override
public boolean equals(Object object)
{
- return object instanceof AludelRecipeInputPair && ItemHelper.equals(((AludelRecipeInputPair) object).inputStack, this.inputStack) && ItemHelper.equals(((AludelRecipeInputPair) object).dustStack, this.dustStack);
+ if (object instanceof AludelRecipeInputPair)
+ {
+ AludelRecipeInputPair recipeInputPair = (AludelRecipeInputPair) object;
+
+ LogHelper.debug(String.format("input - this.itemId: %s, object.inputStack.itemId: %s", this.inputStack.itemID, recipeInputPair.inputStack.itemID));
+ LogHelper.debug(String.format("input - this.meta: %s, object.inputStack.meta: %s", this.inputStack.getItemDamage(), recipeInputPair.inputStack.getItemDamage()));
+ LogHelper.debug(String.format("input - this.stackSize: %s, object.inputStack.stackSize: %s", this.inputStack.stackSize, recipeInputPair.inputStack.stackSize));
+
+ LogHelper.debug(String.format("dust - this.itemId: %s, object.inputStack.itemId: %s", this.dustStack.itemID, recipeInputPair.dustStack.itemID));
+ LogHelper.debug(String.format("dust - this.meta: %s, object.inputStack.meta: %s", this.dustStack.getItemDamage(), recipeInputPair.dustStack.getItemDamage()));
+ LogHelper.debug(String.format("dust - this.stackSize: %s, object.inputStack.stackSize: %s", this.dustStack.stackSize, recipeInputPair.dustStack.stackSize));
+
+ if (this.inputStack.itemID == recipeInputPair.inputStack.itemID && (this.inputStack.getItemDamage() == recipeInputPair.inputStack.getItemDamage() || this.inputStack.getItemDamage() == OreDictionary.WILDCARD_VALUE || recipeInputPair.inputStack.getItemDamage() == OreDictionary.WILDCARD_VALUE) && this.inputStack.stackSize <= recipeInputPair.inputStack.stackSize)
+ {
+ if (this.dustStack.itemID == recipeInputPair.dustStack.itemID && this.dustStack.getItemDamage() == recipeInputPair.dustStack.getItemDamage() && this.dustStack.stackSize <= recipeInputPair.dustStack.stackSize)
+ {
+ return true;
+ }
+ }
+ }
+
+ return false;
}
public boolean isValid()
@@ -27,43 +49,9 @@ public class AludelRecipeInputPair
return inputStack != null && dustStack != null && dustStack.getItem() instanceof ItemAlchemicalDust;
}
- public boolean equalsIgnoreStackSize(AludelRecipeInputPair inputPair)
+ @Override
+ public String toString()
{
- if (this.isValid() && inputPair.isValid())
- {
- return equalsIgnoreStackSize(this.inputStack, inputPair.inputStack) && equalsIgnoreStackSize(this.dustStack, inputPair.dustStack);
- }
-
- return false;
- }
-
- private static boolean equalsIgnoreStackSize(ItemStack itemStack1, ItemStack itemStack2)
- {
- if (itemStack1 != null && itemStack2 != null)
- {
- if (itemStack1.itemID == itemStack2.itemID && itemStack1.getItemDamage() == itemStack2.getItemDamage())
- {
- if (itemStack1.hasTagCompound() && itemStack2.hasTagCompound())
- {
- return itemStack1.getTagCompound().equals(itemStack2.getTagCompound());
- }
- else
- {
- return true;
- }
- }
- else
- {
- OreStack oreStack1 = OreStack.getOreStackFromList(itemStack1);
- OreStack oreStack2 = OreStack.getOreStackFromList(itemStack2);
-
- if (oreStack1 != null && oreStack2 != null)
- {
- return OreStack.compareOreNames(oreStack1, oreStack2);
- }
- }
- }
-
- return false;
+ return String.format("Input stack: %s, Dust stack: %s", ItemHelper.toString(this.inputStack), ItemHelper.toString(this.dustStack));
}
}
diff --git a/src/main/java/com/pahimar/ee3/recipe/RecipesAludel.java b/src/main/java/com/pahimar/ee3/recipe/RecipesAludel.java
index 8f3d48ed..ebdb6943 100644
--- a/src/main/java/com/pahimar/ee3/recipe/RecipesAludel.java
+++ b/src/main/java/com/pahimar/ee3/recipe/RecipesAludel.java
@@ -1,26 +1,26 @@
package com.pahimar.ee3.recipe;
import com.pahimar.ee3.block.ModBlocks;
-import com.pahimar.ee3.helper.ItemHelper;
import com.pahimar.ee3.helper.LogHelper;
import com.pahimar.ee3.item.ModItems;
+import com.pahimar.ee3.item.crafting.RecipeAludel;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
-import java.util.HashMap;
-import java.util.Map;
+import java.util.ArrayList;
+import java.util.List;
public class RecipesAludel
{
private static RecipesAludel aludelRegistry = null;
- private Map aludelRecipes;
+ private List aludelRecipes;
private RecipesAludel()
{
- aludelRecipes = new HashMap();
+ aludelRecipes = new ArrayList();
}
public static RecipesAludel getInstance()
@@ -68,71 +68,31 @@ public class RecipesAludel
public void addRecipe(ItemStack recipeOutput, ItemStack recipeInputStack, ItemStack recipeInputDust)
{
- AludelRecipeInputPair recipeInputPair = new AludelRecipeInputPair(recipeInputStack, recipeInputDust);
-
- if (recipeInputPair.isValid() && recipeOutput != null)
- {
- boolean similiarRecipeExists = false;
-
- for (AludelRecipeInputPair existingRecipeInput : aludelRecipes.keySet())
- {
- if (existingRecipeInput.equalsIgnoreStackSize(recipeInputPair))
- {
- similiarRecipeExists = true;
- }
- }
-
- if (!similiarRecipeExists)
- {
- aludelRecipes.put(recipeInputPair, recipeOutput);
- }
- }
+ // TODO Finish
}
public ItemStack getResult(ItemStack recipeInputStack, ItemStack recipeInputDust)
{
- AludelRecipeInputPair recipeInputPair = new AludelRecipeInputPair(recipeInputStack, recipeInputDust);
-
- if (recipeInputPair.isValid())
- {
- for (AludelRecipeInputPair recipeInputs : aludelRecipes.keySet())
- {
- if (recipeInputPair.equalsIgnoreStackSize(recipeInputPair))
- {
- if (recipeInputPair.inputStack.stackSize >= recipeInputs.inputStack.stackSize && recipeInputPair.dustStack.stackSize >= recipeInputs.dustStack.stackSize)
- {
- return aludelRecipes.get(recipeInputs);
- }
- }
- }
- }
-
+ // TODO Finish
return null;
}
public AludelRecipeInputPair getRecipeInputs(ItemStack itemStack)
{
- for (AludelRecipeInputPair recipeInputPair : aludelRecipes.keySet())
- {
- if (ItemHelper.equals(aludelRecipes.get(recipeInputPair), itemStack))
- {
- return recipeInputPair;
- }
- }
-
+ // TODO Finish
return null;
}
- public Map getRecipeMap()
+ public List getRecipeMap()
{
return aludelRecipes;
}
public void debugDumpMap()
{
- for (AludelRecipeInputPair recipeInputPair : aludelRecipes.keySet())
+ for (RecipeAludel recipeAludel : aludelRecipes)
{
- LogHelper.debug(String.format("Output: %s, Input Stack: %s, Dust Stack: %s", ItemHelper.toString(aludelRecipes.get(recipeInputPair)), ItemHelper.toString(recipeInputPair.inputStack), ItemHelper.toString(recipeInputPair.dustStack)));
+ LogHelper.debug(String.format("Output: %s, Input Stacks: %s", recipeAludel.getRecipeOutput(), recipeAludel.getRecipeInputs()));
}
}
}
diff --git a/src/main/java/com/pahimar/ee3/tileentity/TileAludel.java b/src/main/java/com/pahimar/ee3/tileentity/TileAludel.java
index be584357..71c1288b 100644
--- a/src/main/java/com/pahimar/ee3/tileentity/TileAludel.java
+++ b/src/main/java/com/pahimar/ee3/tileentity/TileAludel.java
@@ -4,11 +4,16 @@ import com.pahimar.ee3.helper.ItemHelper;
import com.pahimar.ee3.lib.Strings;
import com.pahimar.ee3.network.PacketTypeHandler;
import com.pahimar.ee3.network.packet.PacketTileWithItemUpdate;
+import com.pahimar.ee3.recipe.AludelRecipeInputPair;
+import com.pahimar.ee3.recipe.RecipesAludel;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.network.packet.Packet;
+import net.minecraft.tileentity.TileEntityFurnace;
/**
* Equivalent-Exchange-3
@@ -43,7 +48,6 @@ public class TileAludel extends TileEE implements IInventory
@Override
public int getSizeInventory()
{
-
return inventory.length;
}
@@ -109,6 +113,21 @@ public class TileAludel extends TileEE implements IInventory
return 64;
}
+ @Override
+ public boolean receiveClientEvent(int eventId, int eventData)
+ {
+ if (eventId == 1)
+ {
+ this.state = (byte) eventData;
+ this.worldObj.updateAllLightTypes(this.xCoord, this.yCoord, this.zCoord);
+ return true;
+ }
+ else
+ {
+ return super.receiveClientEvent(eventId, eventData);
+ }
+ }
+
@Override
public void openChest()
{
@@ -138,6 +157,10 @@ public class TileAludel extends TileEE implements IInventory
inventory[slotIndex] = ItemStack.loadItemStackFromNBT(tagCompound);
}
}
+
+ deviceCookTime = nbtTagCompound.getInteger("deviceCookTime");
+ fuelBurnTime = nbtTagCompound.getInteger("fuelBurnTime");
+ itemCookTime = nbtTagCompound.getInteger("itemCookTime");
}
@Override
@@ -158,6 +181,9 @@ public class TileAludel extends TileEE implements IInventory
}
}
nbtTagCompound.setTag("Items", tagList);
+ nbtTagCompound.setInteger("deviceCookTime", deviceCookTime);
+ nbtTagCompound.setInteger("fuelBurnTime", fuelBurnTime);
+ nbtTagCompound.setInteger("itemCookTime", itemCookTime);
}
@Override
@@ -172,6 +198,145 @@ public class TileAludel extends TileEE implements IInventory
return true;
}
+ @Override
+ public void updateEntity()
+ {
+ boolean isBurning = this.deviceCookTime > 0;
+ boolean sendUpdate = false;
+
+ // If the Aludel still has burn time, decrement it
+ if (this.deviceCookTime > 0)
+ {
+ this.deviceCookTime--;
+ }
+
+ if (!this.worldObj.isRemote)
+ {
+ // Start "cooking" a new item, if we can
+ if (this.deviceCookTime == 0 && this.canInfuse())
+ {
+ this.fuelBurnTime = this.deviceCookTime = TileEntityFurnace.getItemBurnTime(this.inventory[FUEL_INVENTORY_INDEX]);
+
+ if (this.deviceCookTime > 0)
+ {
+ sendUpdate = true;
+
+ if (this.inventory[FUEL_INVENTORY_INDEX] != null)
+ {
+ --this.inventory[FUEL_INVENTORY_INDEX].stackSize;
+
+ if (this.inventory[FUEL_INVENTORY_INDEX].stackSize == 0)
+ {
+ this.inventory[FUEL_INVENTORY_INDEX] = this.inventory[FUEL_INVENTORY_INDEX].getItem().getContainerItemStack(inventory[FUEL_INVENTORY_INDEX]);
+ }
+ }
+ }
+ }
+
+ // Continue "cooking" the same item, if we can
+ if (this.deviceCookTime > 0 && this.canInfuse())
+ {
+ this.itemCookTime++;
+
+ if (this.itemCookTime == 200)
+ {
+ this.itemCookTime = 0;
+ this.infuseItem();
+ sendUpdate = true;
+ }
+ }
+ else
+ {
+ this.itemCookTime = 0;
+ }
+
+ // If the state has changed, catch that something changed
+ if (isBurning != this.deviceCookTime > 0)
+ {
+ sendUpdate = true;
+ }
+ }
+
+ if (sendUpdate)
+ {
+ this.onInventoryChanged();
+ this.state = this.deviceCookTime > 0 ? (byte) 1 : (byte) 0;
+ this.worldObj.addBlockEvent(this.xCoord, this.yCoord, this.zCoord, this.getBlockType().blockID, 1, this.state);
+ this.worldObj.notifyBlockChange(this.xCoord, this.yCoord, this.zCoord, this.getBlockType().blockID);
+ }
+ }
+
+ @SideOnly(Side.CLIENT)
+ public int getCookProgressScaled(int scale)
+ {
+ return this.itemCookTime * scale / 200;
+ }
+
+ @SideOnly(Side.CLIENT)
+ public int getBurnTimeRemainingScaled(int scale)
+ {
+ if (this.fuelBurnTime > 0)
+ {
+ return this.deviceCookTime * scale / this.fuelBurnTime;
+ }
+ return 0;
+ }
+
+ private boolean canInfuse()
+ {
+ if (inventory[INPUT_INVENTORY_INDEX] == null || inventory[DUST_INVENTORY_INDEX] == null)
+ {
+ return false;
+ }
+ else
+ {
+ ItemStack infusedItemStack = RecipesAludel.getInstance().getResult(inventory[INPUT_INVENTORY_INDEX], inventory[DUST_INVENTORY_INDEX]);
+
+ if (infusedItemStack == null)
+ {
+ return false;
+ }
+
+ if (inventory[OUTPUT_INVENTORY_INDEX] == null)
+ {
+ return true;
+ }
+ else
+ {
+ boolean outputEquals = this.inventory[OUTPUT_INVENTORY_INDEX].isItemEqual(infusedItemStack);
+ int mergedOutputStackSize = this.inventory[OUTPUT_INVENTORY_INDEX].stackSize + infusedItemStack.stackSize;
+
+ if (outputEquals)
+ {
+ return mergedOutputStackSize <= getInventoryStackLimit() && mergedOutputStackSize <= infusedItemStack.getMaxStackSize();
+ }
+ }
+ }
+
+ return false;
+ }
+
+ public void infuseItem()
+ {
+ if (this.canInfuse())
+ {
+ ItemStack infusedItemStack = RecipesAludel.getInstance().getResult(inventory[INPUT_INVENTORY_INDEX], inventory[DUST_INVENTORY_INDEX]);
+ AludelRecipeInputPair inputPair = RecipesAludel.getInstance().getRecipeInputs(infusedItemStack);
+
+ if (this.inventory[OUTPUT_INVENTORY_INDEX] == null)
+ {
+ this.inventory[OUTPUT_INVENTORY_INDEX] = infusedItemStack.copy();
+ }
+ else if (this.inventory[OUTPUT_INVENTORY_INDEX].isItemEqual(infusedItemStack))
+ {
+ inventory[OUTPUT_INVENTORY_INDEX].stackSize += infusedItemStack.stackSize;
+ }
+
+ decrStackSize(INPUT_INVENTORY_INDEX, inputPair.inputStack.stackSize);
+ decrStackSize(DUST_INVENTORY_INDEX, inputPair.dustStack.stackSize);
+ }
+ }
+
@Override
public Packet getDescriptionPacket()
{
diff --git a/src/main/java/com/pahimar/ee3/tileentity/TileCalcinator.java b/src/main/java/com/pahimar/ee3/tileentity/TileCalcinator.java
index 01391481..37c4aa4c 100644
--- a/src/main/java/com/pahimar/ee3/tileentity/TileCalcinator.java
+++ b/src/main/java/com/pahimar/ee3/tileentity/TileCalcinator.java
@@ -440,9 +440,12 @@ public class TileCalcinator extends TileEE implements IInventory
private void sendDustPileData()
{
- this.worldObj.addBlockEvent(this.xCoord, this.yCoord, this.zCoord, this.getBlockType().blockID, 2, getLeftStackSize());
- this.worldObj.addBlockEvent(this.xCoord, this.yCoord, this.zCoord, this.getBlockType().blockID, 3, getLeftStackMeta());
- this.worldObj.addBlockEvent(this.xCoord, this.yCoord, this.zCoord, this.getBlockType().blockID, 4, getRightStackSize());
- this.worldObj.addBlockEvent(this.xCoord, this.yCoord, this.zCoord, this.getBlockType().blockID, 5, getRightStackMeta());
+ if (this.getBlockType() != null)
+ {
+ this.worldObj.addBlockEvent(this.xCoord, this.yCoord, this.zCoord, this.getBlockType().blockID, 2, getLeftStackSize());
+ this.worldObj.addBlockEvent(this.xCoord, this.yCoord, this.zCoord, this.getBlockType().blockID, 3, getLeftStackMeta());
+ this.worldObj.addBlockEvent(this.xCoord, this.yCoord, this.zCoord, this.getBlockType().blockID, 4, getRightStackSize());
+ this.worldObj.addBlockEvent(this.xCoord, this.yCoord, this.zCoord, this.getBlockType().blockID, 5, getRightStackMeta());
+ }
}
}
diff --git a/src/main/resources/assets/ee3/lang/en_US.lang b/src/main/resources/assets/ee3/lang/en_US.lang
index 84475ae3..da47c3e4 100644
--- a/src/main/resources/assets/ee3/lang/en_US.lang
+++ b/src/main/resources/assets/ee3/lang/en_US.lang
@@ -21,11 +21,11 @@ item.ee3:stoneMinium.name=Minium Stone [WIP]
item.ee3:stonePhilosophers.name=Philosopher's Stone [WIP]
# Block localizations
-tile.ee3:alchemicalChest.name=Alchemical Chest [WIP]
+tile.ee3:alchemicalChest.name=Alchemical Chest
tile.ee3:alchemicalFuelBlock.alchemicalCoal.name=Alchemical Coal Block
tile.ee3:alchemicalFuelBlock.mobiusFuel.name=Mobius Fuel Block
tile.ee3:alchemicalFuelBlock.aeternalisFuel.name=Aeternalis Fuel Block
-tile.ee3:aludel.name=Aludel [WIP]
+tile.ee3:aludel.name=Aludel Base
tile.ee3:calcinator.name=Calcinator
tile.ee3:chalk.name=Chalk
tile.ee3:glassBell.name=Glass Bell
@@ -36,8 +36,8 @@ tile.ee3:infusedPlanks.name=Infused Wood Planks
# GUI localizations
container.ee3:alchemicalBag=Alchemical Bag [WIP]
-container.ee3:alchemicalChest=Alchemical Chest [WIP]
-container.ee3:aludel=Aludel [WIP]
+container.ee3:alchemicalChest=Alchemical Chest
+container.ee3:aludel=Aludel
container.ee3:calcinator=Calcinator
container.ee3:glassBell=Glass Bell
container.ee3:researchStation=Research Station [WIP]
diff --git a/src/main/resources/assets/ee3/textures/models/aludel.png b/src/main/resources/assets/ee3/textures/models/aludel.png
index 3ce33d8d..8419bf26 100644
Binary files a/src/main/resources/assets/ee3/textures/models/aludel.png and b/src/main/resources/assets/ee3/textures/models/aludel.png differ
diff --git a/src/main/resources/assets/ee3/textures/models/calcinator.png b/src/main/resources/assets/ee3/textures/models/calcinator.png
deleted file mode 100644
index 68ec413e..00000000
Binary files a/src/main/resources/assets/ee3/textures/models/calcinator.png and /dev/null differ
diff --git a/src/main/resources/assets/ee3/textures/models/calcinator_idle.png b/src/main/resources/assets/ee3/textures/models/calcinator_idle.png
new file mode 100644
index 00000000..fbf20f0e
Binary files /dev/null and b/src/main/resources/assets/ee3/textures/models/calcinator_idle.png differ
diff --git a/src/main/resources/assets/ee3/textures/xcf/models/aludel.xcf b/src/main/resources/assets/ee3/textures/xcf/models/aludel.xcf
index 5f8652b7..6924f16d 100644
Binary files a/src/main/resources/assets/ee3/textures/xcf/models/aludel.xcf and b/src/main/resources/assets/ee3/textures/xcf/models/aludel.xcf differ