Too distracted to code, so committing a whack of stuff
This commit is contained in:
parent
8a0da1b572
commit
ad8f6d5a3d
|
@ -115,6 +115,11 @@ public final class EnergyValueRegistryProxy
|
|||
return EE3Wrapper.ee3mod.getEnergyValueRegistry().getStacksInRange(start, finish);
|
||||
}
|
||||
|
||||
private static class EE3Wrapper
|
||||
{
|
||||
private static EquivalentExchange3 ee3mod;
|
||||
}
|
||||
|
||||
private static void init()
|
||||
{
|
||||
if (ee3Mod != null)
|
||||
|
@ -122,9 +127,4 @@ public final class EnergyValueRegistryProxy
|
|||
EE3Wrapper.ee3mod = (EquivalentExchange3) ee3Mod;
|
||||
}
|
||||
}
|
||||
|
||||
private static class EE3Wrapper
|
||||
{
|
||||
private static EquivalentExchange3 ee3mod;
|
||||
}
|
||||
}
|
||||
|
|
23
src/main/java/com/pahimar/ee3/api/RecipeRegistryProxy.java
Normal file
23
src/main/java/com/pahimar/ee3/api/RecipeRegistryProxy.java
Normal file
|
@ -0,0 +1,23 @@
|
|||
package com.pahimar.ee3.api;
|
||||
|
||||
import com.pahimar.ee3.EquivalentExchange3;
|
||||
import cpw.mods.fml.common.Mod;
|
||||
|
||||
public class RecipeRegistryProxy
|
||||
{
|
||||
@Mod.Instance("EE3")
|
||||
private static Object ee3Mod;
|
||||
|
||||
private static class EE3Wrapper
|
||||
{
|
||||
private static EquivalentExchange3 ee3mod;
|
||||
}
|
||||
|
||||
private static void init()
|
||||
{
|
||||
if (ee3Mod != null)
|
||||
{
|
||||
EE3Wrapper.ee3mod = (EquivalentExchange3) ee3Mod;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -11,6 +11,11 @@ public class SkillRegistryProxy
|
|||
@Mod.Instance("EE3")
|
||||
private static Object ee3Mod;
|
||||
|
||||
public static void addSkill(Block block)
|
||||
{
|
||||
addSkill(new ItemStack(block));
|
||||
}
|
||||
|
||||
public static void addSkill(Item item)
|
||||
{
|
||||
addSkill(new ItemStack(item));
|
||||
|
@ -34,6 +39,37 @@ public class SkillRegistryProxy
|
|||
EE3Wrapper.ee3mod.getSkillRegistry().addSkill(itemStack, isLearnable, isRecovereable);
|
||||
}
|
||||
|
||||
public static boolean isLearnable(ItemStack itemStack)
|
||||
{
|
||||
init();
|
||||
|
||||
// NOOP if EquivalentExchange3 is not present
|
||||
if (ee3Mod == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return EE3Wrapper.ee3mod.getSkillRegistry().isLearnable(itemStack);
|
||||
}
|
||||
|
||||
public static boolean isRecoverable(ItemStack itemStack)
|
||||
{
|
||||
init();
|
||||
|
||||
// NOOP if EquivalentExchange3 is not present
|
||||
if (ee3Mod == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return EE3Wrapper.ee3mod.getSkillRegistry().isRecoverable(itemStack);
|
||||
}
|
||||
|
||||
private static class EE3Wrapper
|
||||
{
|
||||
private static EquivalentExchange3 ee3mod;
|
||||
}
|
||||
|
||||
private static void init()
|
||||
{
|
||||
if (ee3Mod != null)
|
||||
|
@ -41,40 +77,4 @@ public class SkillRegistryProxy
|
|||
EE3Wrapper.ee3mod = (EquivalentExchange3) ee3Mod;
|
||||
}
|
||||
}
|
||||
|
||||
public static void addSkill(Block block)
|
||||
{
|
||||
addSkill(new ItemStack(block));
|
||||
}
|
||||
|
||||
public static void isLearnable(ItemStack itemStack)
|
||||
{
|
||||
init();
|
||||
|
||||
// NOOP if EquivalentExchange3 is not present
|
||||
if (ee3Mod == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
EE3Wrapper.ee3mod.getSkillRegistry().isLearnable(itemStack);
|
||||
}
|
||||
|
||||
public static void isRecoverable(ItemStack itemStack)
|
||||
{
|
||||
init();
|
||||
|
||||
// NOOP if EquivalentExchange3 is not present
|
||||
if (ee3Mod == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
EE3Wrapper.ee3mod.getSkillRegistry().isRecoverable(itemStack);
|
||||
}
|
||||
|
||||
private static class EE3Wrapper
|
||||
{
|
||||
private static EquivalentExchange3 ee3mod;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,5 +41,8 @@ public class GuiResearchStation extends GuiContainer
|
|||
int xStart = (width - xSize) / 2;
|
||||
int yStart = (height - ySize) / 2;
|
||||
this.drawTexturedModalRect(xStart, yStart, 0, 0, xSize, ySize);
|
||||
|
||||
int scaleAdjustment = this.tileEntityResearchStation.getLearnProgressScaled(57);
|
||||
this.drawTexturedModalRect(xStart + 60, yStart + 41, 176, 0, scaleAdjustment, 16);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,10 +28,10 @@ public class ConfigurationHandler
|
|||
private static void loadConfiguration()
|
||||
{
|
||||
// TODO Come back and do these constants in logical locations and names
|
||||
Settings.Transmutation.KNOWLEDGE_MODE = ConfigurationHelper.getString(configuration, Messages.Configuration.TRANSMUTATION_KNOWLEDGE_MODE, Messages.Configuration.CATEGORY_TRANSMUTATION, "All", StatCollector.translateToLocal(Messages.Configuration.TRANSMUTATION_KNOWLEDGE_MODE_COMMENT), new String[]{"All", "Select", "None"}, Messages.Configuration.TRANSMUTATION_KNOWLEDGE_MODE_LABEL);
|
||||
Settings.Transmutation.USE_TEMPLATE_FILE = configuration.getBoolean(Messages.Configuration.TRANSMUTATION_KNOWLEDGE_TEMPLATE, Messages.Configuration.CATEGORY_TRANSMUTATION, true, StatCollector.translateToLocal(Messages.Configuration.TRANSMUTATION_KNOWLEDGE_TEMPLATE_COMMENT), Messages.Configuration.TRANSMUTATION_KNOWLEDGE_TEMPLATE_LABEL);
|
||||
Settings.Transmutation.knowledgeMode = ConfigurationHelper.getString(configuration, Messages.Configuration.TRANSMUTATION_KNOWLEDGE_MODE, Messages.Configuration.CATEGORY_TRANSMUTATION, "All", StatCollector.translateToLocal(Messages.Configuration.TRANSMUTATION_KNOWLEDGE_MODE_COMMENT), new String[]{"All", "Select", "None"}, Messages.Configuration.TRANSMUTATION_KNOWLEDGE_MODE_LABEL);
|
||||
Settings.Transmutation.useTemplateFile = configuration.getBoolean(Messages.Configuration.TRANSMUTATION_KNOWLEDGE_TEMPLATE, Messages.Configuration.CATEGORY_TRANSMUTATION, true, StatCollector.translateToLocal(Messages.Configuration.TRANSMUTATION_KNOWLEDGE_TEMPLATE_COMMENT), Messages.Configuration.TRANSMUTATION_KNOWLEDGE_TEMPLATE_LABEL);
|
||||
|
||||
LogHelper.info(Settings.Transmutation.KNOWLEDGE_MODE);
|
||||
LogHelper.info(Settings.Transmutation.knowledgeMode);
|
||||
if (configuration.hasChanged())
|
||||
{
|
||||
configuration.save();
|
||||
|
|
|
@ -30,7 +30,7 @@ public class PlayerKnowledgeHandler
|
|||
|
||||
if (playerKnowledge == null)
|
||||
{
|
||||
if (Settings.Transmutation.USE_TEMPLATE_FILE)
|
||||
if (Settings.Transmutation.useTemplateFile)
|
||||
{
|
||||
playerKnowledgeCompound = readTemplateKnowledgeFile();
|
||||
}
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
package com.pahimar.ee3.init;
|
||||
|
||||
import com.pahimar.ee3.recipe.RecipesAludel;
|
||||
import com.pahimar.ee3.util.CraftingHelper;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||
|
||||
public class Recipes
|
||||
{
|
||||
|
@ -18,39 +18,39 @@ public class Recipes
|
|||
|
||||
private static void initModRecipes()
|
||||
{
|
||||
GameRegistry.addRecipe(new ItemStack(ModBlocks.alchemicalFuelBlock, 1, 0), "fff", "fff", "fff", 'f', new ItemStack(ModItems.alchemicalFuel, 1, 0));
|
||||
GameRegistry.addRecipe(new ItemStack(ModBlocks.alchemicalFuelBlock, 1, 1), "fff", "fff", "fff", 'f', new ItemStack(ModItems.alchemicalFuel, 1, 1));
|
||||
GameRegistry.addRecipe(new ItemStack(ModBlocks.alchemicalFuelBlock, 1, 2), "fff", "fff", "fff", 'f', new ItemStack(ModItems.alchemicalFuel, 1, 2));
|
||||
GameRegistry.addShapedRecipe(new ItemStack(ModBlocks.alchemicalFuelBlock, 1, 0), "fff", "fff", "fff", 'f', new ItemStack(ModItems.alchemicalFuel, 1, 0));
|
||||
GameRegistry.addShapedRecipe(new ItemStack(ModBlocks.alchemicalFuelBlock, 1, 1), "fff", "fff", "fff", 'f', new ItemStack(ModItems.alchemicalFuel, 1, 1));
|
||||
GameRegistry.addShapedRecipe(new ItemStack(ModBlocks.alchemicalFuelBlock, 1, 2), "fff", "fff", "fff", 'f', new ItemStack(ModItems.alchemicalFuel, 1, 2));
|
||||
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(ModItems.alchemicalFuel, 9, 0), new ItemStack(ModBlocks.alchemicalFuelBlock, 1, 0));
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(ModItems.alchemicalFuel, 9, 1), new ItemStack(ModBlocks.alchemicalFuelBlock, 1, 1));
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(ModItems.alchemicalFuel, 9, 2), new ItemStack(ModBlocks.alchemicalFuelBlock, 1, 2));
|
||||
|
||||
GameRegistry.addRecipe(new ItemStack(ModBlocks.chalkBlock), "bcb", "cbc", "bcb", 'b', new ItemStack(Items.dye, 1, 15), 'c', new ItemStack(Items.clay_ball));
|
||||
GameRegistry.addRecipe(new ItemStack(ModBlocks.chalkBlock), "cc", "cc", 'c', new ItemStack(ModItems.chalk));
|
||||
GameRegistry.addShapedRecipe(new ItemStack(ModBlocks.chalkBlock), "bcb", "cbc", "bcb", 'b', new ItemStack(Items.dye, 1, 15), 'c', new ItemStack(Items.clay_ball));
|
||||
GameRegistry.addShapedRecipe(new ItemStack(ModBlocks.chalkBlock), "cc", "cc", 'c', new ItemStack(ModItems.chalk));
|
||||
|
||||
GameRegistry.addRecipe(new ItemStack(ModBlocks.glassBell), "ggg", "g g", "g g", 'g', Blocks.glass);
|
||||
CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.calcinator), "i i", "sis", "s s", 'i', "ingotIron", 's', Blocks.stone);
|
||||
CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.aludel), "iii", "sis", "iii", 'i', "ingotIron", 's', Blocks.stone);
|
||||
CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.researchStation), "ipi", " s ", "sss", 'i', "ingotIron", 's', Blocks.stone, 'p', "slabWood");
|
||||
GameRegistry.addShapedRecipe(new ItemStack(ModBlocks.glassBell), "ggg", "g g", "g g", 'g', Blocks.glass);
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.calcinator), "i i", "sis", "s s", 'i', "ingotIron", 's', Blocks.stone));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.aludel), "iii", "sis", "iii", 'i', "ingotIron", 's', Blocks.stone));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.researchStation), "ipi", " s ", "sss", 'i', "ingotIron", 's', Blocks.stone, 'p', "slabWood"));
|
||||
|
||||
CraftingHelper.addShapedOreRecipe(new ItemStack(ModItems.stoneInert), "sis", "igi", "sis", 's', Blocks.stone, 'i', "ingotIron", 'g', "ingotGold");
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.stoneInert), "sis", "igi", "sis", 's', Blocks.stone, 'i', "ingotIron", 'g', "ingotGold"));
|
||||
|
||||
CraftingHelper.addShapedOreRecipe(new ItemStack(ModItems.diviningRod), " s ", " s ", "s s", 's', "stickWood");
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.diviningRod), " s ", " s ", "s s", 's', "stickWood"));
|
||||
|
||||
CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.augmentationTable), "i ", "sss", "p p", 'i', "ingotIron", 's', "slabWood", 'p', "plankWood");
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.augmentationTable), "i ", "sss", "p p", 'i', "ingotIron", 's', "slabWood", 'p', "plankWood"));
|
||||
|
||||
GameRegistry.addRecipe(new ItemStack(ModItems.shovelDarkMatter), "m", "d", "d", 'm', new ItemStack(ModItems.matter, 1, 0), 'd', Items.diamond);
|
||||
GameRegistry.addRecipe(new ItemStack(ModItems.pickAxeDarkMatter), "mmm", " d ", " d ", 'm', new ItemStack(ModItems.matter, 1, 0), 'd', Items.diamond);
|
||||
GameRegistry.addRecipe(new ItemStack(ModItems.hammerDarkMatter), "mmm", "mdm", " d ", 'm', new ItemStack(ModItems.matter, 1, 0), 'd', Items.diamond);
|
||||
GameRegistry.addRecipe(new ItemStack(ModItems.axeDarkMatter), "mm ", "md ", " d ", 'm', new ItemStack(ModItems.matter, 1, 0), 'd', Items.diamond);
|
||||
GameRegistry.addRecipe(new ItemStack(ModItems.hoeDarkMatter), "mm ", " d ", " d ", 'm', new ItemStack(ModItems.matter, 1, 0), 'd', Items.diamond);
|
||||
CraftingHelper.addShapedOreRecipe(new ItemStack(ModItems.fishingRodDarkMatter), " w", " ws", "m s", 'm', new ItemStack(ModItems.matter, 1, 0), 'w', "stickWood", 's', new ItemStack(Items.string));
|
||||
GameRegistry.addRecipe(new ItemStack(ModItems.shearsDarkMatter), "m ", " m", 'm', new ItemStack(ModItems.matter, 1, 0));
|
||||
GameRegistry.addShapedRecipe(new ItemStack(ModItems.shovelDarkMatter), "m", "d", "d", 'm', new ItemStack(ModItems.matter, 1, 0), 'd', Items.diamond);
|
||||
GameRegistry.addShapedRecipe(new ItemStack(ModItems.pickAxeDarkMatter), "mmm", " d ", " d ", 'm', new ItemStack(ModItems.matter, 1, 0), 'd', Items.diamond);
|
||||
GameRegistry.addShapedRecipe(new ItemStack(ModItems.hammerDarkMatter), "mmm", "mdm", " d ", 'm', new ItemStack(ModItems.matter, 1, 0), 'd', Items.diamond);
|
||||
GameRegistry.addShapedRecipe(new ItemStack(ModItems.axeDarkMatter), "mm ", "md ", " d ", 'm', new ItemStack(ModItems.matter, 1, 0), 'd', Items.diamond);
|
||||
GameRegistry.addShapedRecipe(new ItemStack(ModItems.hoeDarkMatter), "mm ", " d ", " d ", 'm', new ItemStack(ModItems.matter, 1, 0), 'd', Items.diamond);
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.fishingRodDarkMatter), " w", " ws", "m s", 'm', new ItemStack(ModItems.matter, 1, 0), 'w', "stickWood", 's', new ItemStack(Items.string)));
|
||||
GameRegistry.addShapedRecipe(new ItemStack(ModItems.shearsDarkMatter), "m ", " m", 'm', new ItemStack(ModItems.matter, 1, 0));
|
||||
|
||||
GameRegistry.addRecipe(new ItemStack(ModItems.bowDarkMatter), "sm ", "s m", "sm ", 'm', new ItemStack(ModItems.matter, 1, 0), 's', new ItemStack(Items.string));
|
||||
CraftingHelper.addShapedOreRecipe(new ItemStack(ModItems.arrowDarkMatter, 64), " m", " s ", "f ", 'm', new ItemStack(ModItems.matter, 1, 0), 's', "stickWood", 'f', new ItemStack(Items.feather));
|
||||
GameRegistry.addRecipe(new ItemStack(ModItems.swordDarkMatter), "m", "m", "d", 'm', new ItemStack(ModItems.matter, 1, 0), 'd', Items.diamond);
|
||||
GameRegistry.addShapedRecipe(new ItemStack(ModItems.bowDarkMatter), "sm ", "s m", "sm ", 'm', new ItemStack(ModItems.matter, 1, 0), 's', new ItemStack(Items.string));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.arrowDarkMatter, 64), " m", " s ", "f ", 'm', new ItemStack(ModItems.matter, 1, 0), 's', "stickWood", 'f', new ItemStack(Items.feather)));
|
||||
GameRegistry.addShapedRecipe(new ItemStack(ModItems.swordDarkMatter), "m", "m", "d", 'm', new ItemStack(ModItems.matter, 1, 0), 'd', Items.diamond);
|
||||
}
|
||||
|
||||
private static void initAludelRecipes()
|
||||
|
|
|
@ -2,14 +2,18 @@ package com.pahimar.ee3.inventory;
|
|||
|
||||
import com.pahimar.ee3.item.ItemAlchemicalTome;
|
||||
import com.pahimar.ee3.tileentity.TileEntityResearchStation;
|
||||
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.ICrafting;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ContainerResearchStation extends ContainerEE
|
||||
{
|
||||
private TileEntityResearchStation tileEntityResearchStation;
|
||||
private int lastItemLearnTime;
|
||||
|
||||
public ContainerResearchStation(InventoryPlayer inventoryPlayer, TileEntityResearchStation tileEntityResearchStation)
|
||||
{
|
||||
|
@ -34,6 +38,40 @@ public class ContainerResearchStation extends ContainerEE
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCraftingToCrafters(ICrafting iCrafting)
|
||||
{
|
||||
super.addCraftingToCrafters(iCrafting);
|
||||
iCrafting.sendProgressBarUpdate(this, 0, this.tileEntityResearchStation.itemLearnTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges()
|
||||
{
|
||||
super.detectAndSendChanges();
|
||||
|
||||
for (Object crafter : this.crafters)
|
||||
{
|
||||
ICrafting icrafting = (ICrafting) crafter;
|
||||
|
||||
if (this.lastItemLearnTime != this.tileEntityResearchStation.itemLearnTime)
|
||||
{
|
||||
icrafting.sendProgressBarUpdate(this, 0, this.tileEntityResearchStation.itemLearnTime);
|
||||
}
|
||||
}
|
||||
|
||||
this.lastItemLearnTime = this.tileEntityResearchStation.itemLearnTime;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void updateProgressBar(int valueType, int updatedValue)
|
||||
{
|
||||
if (valueType == 0)
|
||||
{
|
||||
this.tileEntityResearchStation.itemLearnTime = updatedValue;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer entityPlayer, int slotIndex)
|
||||
{
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
package com.pahimar.ee3.item;
|
||||
|
||||
import com.pahimar.ee3.reference.Names;
|
||||
import com.pahimar.ee3.skill.PlayerKnowledge;
|
||||
import com.pahimar.ee3.util.IOwnable;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ItemAlchemicalTome extends ItemEE implements IOwnable
|
||||
{
|
||||
|
@ -10,4 +12,15 @@ public class ItemAlchemicalTome extends ItemEE implements IOwnable
|
|||
super();
|
||||
this.setUnlocalizedName(Names.Items.ALCHEMICAL_TOME);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getShareTag()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public PlayerKnowledge getPlayerKnowledge(ItemStack itemStack)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,10 @@ public class Settings
|
|||
{
|
||||
public static class Transmutation
|
||||
{
|
||||
public static String KNOWLEDGE_MODE;
|
||||
public static boolean USE_TEMPLATE_FILE;
|
||||
public static String knowledgeMode;
|
||||
public static final String KNOWLEDGE_MODE_ALL = "All";
|
||||
public static final String KNOWLEDGE_MODE_SELECT = "Select";
|
||||
public static final String KNOWLEDGE_MODE_NONE = "None";
|
||||
public static boolean useTemplateFile;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,6 +33,11 @@ public class SkillRegistry
|
|||
skillMap = new TreeMap<ItemStack, Skill>(ItemHelper.comparator);
|
||||
}
|
||||
|
||||
public void addSkill(Block block)
|
||||
{
|
||||
addSkill(new ItemStack(block));
|
||||
}
|
||||
|
||||
public void addSkill(Item item)
|
||||
{
|
||||
addSkill(new ItemStack(item));
|
||||
|
@ -50,22 +55,23 @@ public class SkillRegistry
|
|||
|
||||
private void addSkill(ItemStack itemStack, Skill skill)
|
||||
{
|
||||
if (!skillMap.containsKey(itemStack))
|
||||
{
|
||||
skillMap.put(itemStack, skill);
|
||||
}
|
||||
}
|
||||
ItemStack unitItemStack = itemStack.copy();
|
||||
unitItemStack.stackSize = 1;
|
||||
|
||||
public void addSkill(Block block)
|
||||
{
|
||||
addSkill(new ItemStack(block));
|
||||
if (!skillMap.containsKey(unitItemStack))
|
||||
{
|
||||
skillMap.put(unitItemStack, skill);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isLearnable(ItemStack itemStack)
|
||||
{
|
||||
if (skillMap.containsKey(itemStack))
|
||||
ItemStack unitItemStack = itemStack.copy();
|
||||
unitItemStack.stackSize = 1;
|
||||
|
||||
if (skillMap.containsKey(unitItemStack))
|
||||
{
|
||||
return skillMap.get(itemStack).isLearnable();
|
||||
return skillMap.get(unitItemStack).isLearnable();
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -73,9 +79,12 @@ public class SkillRegistry
|
|||
|
||||
public boolean isRecoverable(ItemStack itemStack)
|
||||
{
|
||||
if (skillMap.containsKey(itemStack))
|
||||
ItemStack unitItemStack = itemStack.copy();
|
||||
unitItemStack.stackSize = 1;
|
||||
|
||||
if (skillMap.containsKey(unitItemStack))
|
||||
{
|
||||
return skillMap.get(itemStack).isRecoverable();
|
||||
return skillMap.get(unitItemStack).isRecoverable();
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
package com.pahimar.ee3.tileentity;
|
||||
|
||||
import com.pahimar.ee3.exchange.EnergyValueRegistry;
|
||||
import com.pahimar.ee3.reference.Names;
|
||||
import com.pahimar.ee3.reference.Settings;
|
||||
import com.pahimar.ee3.skill.SkillRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -141,6 +146,7 @@ public class TileEntityResearchStation extends TileEntityEE implements IInventor
|
|||
}
|
||||
}
|
||||
nbtTagCompound.setTag(Names.NBT.ITEMS, tagList);
|
||||
nbtTagCompound.setInteger("itemLearnTime", itemLearnTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -160,12 +166,36 @@ public class TileEntityResearchStation extends TileEntityEE implements IInventor
|
|||
inventory[slotIndex] = ItemStack.loadItemStackFromNBT(tagCompound);
|
||||
}
|
||||
}
|
||||
itemLearnTime = nbtTagCompound.getInteger("itemLearnTime");
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getLearnProgressScaled(int scale)
|
||||
{
|
||||
return this.itemLearnTime * scale / 200;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity()
|
||||
{
|
||||
if (!this.worldObj.isRemote)
|
||||
{
|
||||
// Continue "cooking" the same item, if we can
|
||||
if (this.canLearnItemStack())
|
||||
{
|
||||
this.itemLearnTime++;
|
||||
|
||||
if (this.itemLearnTime == 200)
|
||||
{
|
||||
this.itemLearnTime = 0;
|
||||
this.learnItemStack();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.itemLearnTime = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean canLearnItemStack()
|
||||
|
@ -176,9 +206,33 @@ public class TileEntityResearchStation extends TileEntityEE implements IInventor
|
|||
}
|
||||
else
|
||||
{
|
||||
// TODO Check the book in the Tome spot to see if it already knows the itemstack
|
||||
|
||||
if (Settings.Transmutation.knowledgeMode.equalsIgnoreCase(Settings.Transmutation.KNOWLEDGE_MODE_ALL))
|
||||
{
|
||||
return EnergyValueRegistry.getInstance().hasEnergyValue(inventory[ITEM_SLOT_INVENTORY_INDEX]);
|
||||
}
|
||||
else if (Settings.Transmutation.knowledgeMode.equalsIgnoreCase(Settings.Transmutation.KNOWLEDGE_MODE_SELECT))
|
||||
{
|
||||
return EnergyValueRegistry.getInstance().hasEnergyValue(inventory[ITEM_SLOT_INVENTORY_INDEX]) && SkillRegistry.getInstance().isLearnable(inventory[ITEM_SLOT_INVENTORY_INDEX]);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private void learnItemStack()
|
||||
{
|
||||
if (this.canLearnItemStack())
|
||||
{
|
||||
// TODO Add the input item to the books knowledge
|
||||
|
||||
this.inventory[ITEM_SLOT_INVENTORY_INDEX].stackSize--;
|
||||
|
||||
if (this.inventory[ITEM_SLOT_INVENTORY_INDEX].stackSize <= 0)
|
||||
{
|
||||
this.inventory[ITEM_SLOT_INVENTORY_INDEX] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
package com.pahimar.ee3.util;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||
import net.minecraftforge.oredict.ShapelessOreRecipe;
|
||||
|
||||
public class CraftingHelper
|
||||
{
|
||||
public static void addShapedOreRecipe(ItemStack outputItemStack, Object... objectInputs)
|
||||
{
|
||||
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(outputItemStack, objectInputs));
|
||||
}
|
||||
|
||||
public static void addShapelessOreRecipe(ItemStack outputItemStack, Object... objectInputs)
|
||||
{
|
||||
CraftingManager.getInstance().getRecipeList().add(new ShapelessOreRecipe(outputItemStack, objectInputs));
|
||||
}
|
||||
}
|
|
@ -227,4 +227,23 @@ public class NBTHelper
|
|||
|
||||
itemStack.stackTagCompound.setDouble(keyName, keyValue);
|
||||
}
|
||||
|
||||
public static NBTTagCompound getTagCompound(ItemStack itemStack, String keyName)
|
||||
{
|
||||
initNBTTagCompound(itemStack);
|
||||
|
||||
if (!itemStack.stackTagCompound.hasKey(keyName))
|
||||
{
|
||||
setDouble(itemStack, keyName, 0);
|
||||
}
|
||||
|
||||
return itemStack.stackTagCompound.getCompoundTag(keyName);
|
||||
}
|
||||
|
||||
public static void setTagCompound(ItemStack itemStack, String keyName, NBTTagCompound nbtTagCompound)
|
||||
{
|
||||
initNBTTagCompound(itemStack);
|
||||
|
||||
itemStack.stackTagCompound.setTag(keyName, nbtTagCompound);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue