More API related shenanigans, MUCH more to come (provide comments on your API related needs to pahimar@gmail.com)
This commit is contained in:
parent
a1dc2d2130
commit
32bbca53cb
27 changed files with 230 additions and 160 deletions
|
@ -1,6 +1,7 @@
|
||||||
package com.pahimar.ee3;
|
package com.pahimar.ee3;
|
||||||
|
|
||||||
import com.pahimar.ee3.configuration.ConfigurationHandler;
|
import com.pahimar.ee3.configuration.ConfigurationHandler;
|
||||||
|
import com.pahimar.ee3.exchange.EnergyValueRegistry;
|
||||||
import com.pahimar.ee3.handler.CraftingHandler;
|
import com.pahimar.ee3.handler.CraftingHandler;
|
||||||
import com.pahimar.ee3.handler.FuelHandler;
|
import com.pahimar.ee3.handler.FuelHandler;
|
||||||
import com.pahimar.ee3.handler.GuiHandler;
|
import com.pahimar.ee3.handler.GuiHandler;
|
||||||
|
@ -11,6 +12,7 @@ import com.pahimar.ee3.network.PacketHandler;
|
||||||
import com.pahimar.ee3.proxy.IProxy;
|
import com.pahimar.ee3.proxy.IProxy;
|
||||||
import com.pahimar.ee3.reference.Messages;
|
import com.pahimar.ee3.reference.Messages;
|
||||||
import com.pahimar.ee3.reference.Reference;
|
import com.pahimar.ee3.reference.Reference;
|
||||||
|
import com.pahimar.ee3.skill.SkillRegistry;
|
||||||
import com.pahimar.ee3.util.LogHelper;
|
import com.pahimar.ee3.util.LogHelper;
|
||||||
import cpw.mods.fml.common.Mod;
|
import cpw.mods.fml.common.Mod;
|
||||||
import cpw.mods.fml.common.Mod.EventHandler;
|
import cpw.mods.fml.common.Mod.EventHandler;
|
||||||
|
@ -100,4 +102,14 @@ public class EquivalentExchange3
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public EnergyValueRegistry getEnergyValueRegistry()
|
||||||
|
{
|
||||||
|
return EnergyValueRegistry.getInstance();
|
||||||
|
}
|
||||||
|
|
||||||
|
public SkillRegistry getSkillRegistry()
|
||||||
|
{
|
||||||
|
return SkillRegistry.getInstance();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,62 @@
|
||||||
|
package com.pahimar.ee3.api;
|
||||||
|
|
||||||
|
import com.pahimar.ee3.EquivalentExchange3;
|
||||||
|
import cpw.mods.fml.common.Mod;
|
||||||
|
|
||||||
|
public class EnergyValueRegistryProxy
|
||||||
|
{
|
||||||
|
@Mod.Instance("EE3")
|
||||||
|
private static Object ee3Mod;
|
||||||
|
|
||||||
|
public static void addValue(IEnergyValue energyValue)
|
||||||
|
{
|
||||||
|
init();
|
||||||
|
|
||||||
|
// NOOP if EquivalentExchange3 is not present
|
||||||
|
if (ee3Mod == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void init()
|
||||||
|
{
|
||||||
|
if (ee3Mod != null)
|
||||||
|
{
|
||||||
|
EE3Wrapper.ee3mod = (EquivalentExchange3) ee3Mod;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void getValue(Object object)
|
||||||
|
{
|
||||||
|
init();
|
||||||
|
|
||||||
|
// NOOP if EquivalentExchange3 is not present
|
||||||
|
if (ee3Mod == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
EE3Wrapper.ee3mod.getEnergyValueRegistry().getEnergyValue(object);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void getValue(Object object, boolean strict)
|
||||||
|
{
|
||||||
|
init();
|
||||||
|
|
||||||
|
// NOOP if EquivalentExchange3 is not present
|
||||||
|
if (ee3Mod == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
EE3Wrapper.ee3mod.getEnergyValueRegistry().getEnergyValue(object, strict);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class EE3Wrapper
|
||||||
|
{
|
||||||
|
private static EquivalentExchange3 ee3mod;
|
||||||
|
}
|
||||||
|
}
|
5
src/main/java/com/pahimar/ee3/api/IEnergyValue.java
Normal file
5
src/main/java/com/pahimar/ee3/api/IEnergyValue.java
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
package com.pahimar.ee3.api;
|
||||||
|
|
||||||
|
public interface IEnergyValue
|
||||||
|
{
|
||||||
|
}
|
|
@ -0,0 +1,8 @@
|
||||||
|
package com.pahimar.ee3.api;
|
||||||
|
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
|
public interface IEnergyValueProvider
|
||||||
|
{
|
||||||
|
public abstract IEnergyValue getEnergyValue(ItemStack itemStack);
|
||||||
|
}
|
80
src/main/java/com/pahimar/ee3/api/SkillRegistryProxy.java
Normal file
80
src/main/java/com/pahimar/ee3/api/SkillRegistryProxy.java
Normal file
|
@ -0,0 +1,80 @@
|
||||||
|
package com.pahimar.ee3.api;
|
||||||
|
|
||||||
|
import com.pahimar.ee3.EquivalentExchange3;
|
||||||
|
import cpw.mods.fml.common.Mod;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
|
public class SkillRegistryProxy
|
||||||
|
{
|
||||||
|
@Mod.Instance("EE3")
|
||||||
|
private static Object ee3Mod;
|
||||||
|
|
||||||
|
public static void addSkill(Item item)
|
||||||
|
{
|
||||||
|
addSkill(new ItemStack(item));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void addSkill(ItemStack itemStack)
|
||||||
|
{
|
||||||
|
addSkill(itemStack, true, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void addSkill(ItemStack itemStack, boolean isLearnable, boolean isRecovereable)
|
||||||
|
{
|
||||||
|
init();
|
||||||
|
|
||||||
|
// NOOP if EquivalentExchange3 is not present
|
||||||
|
if (ee3Mod == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
EE3Wrapper.ee3mod.getSkillRegistry().addSkill(itemStack, isLearnable, isRecovereable);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void init()
|
||||||
|
{
|
||||||
|
if (ee3Mod != null)
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,8 +0,0 @@
|
||||||
package com.pahimar.ee3.api.exchange;
|
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
|
|
||||||
public interface IEnergyValueProvider
|
|
||||||
{
|
|
||||||
public abstract EnergyValue getEnergyValue(ItemStack itemStack);
|
|
||||||
}
|
|
|
@ -1,8 +1,8 @@
|
||||||
package com.pahimar.ee3.client.handler;
|
package com.pahimar.ee3.client.handler;
|
||||||
|
|
||||||
import com.pahimar.ee3.api.core.WrappedStack;
|
import com.pahimar.ee3.exchange.EnergyValue;
|
||||||
import com.pahimar.ee3.api.exchange.EnergyValue;
|
import com.pahimar.ee3.exchange.EnergyValueRegistry;
|
||||||
import com.pahimar.ee3.api.exchange.EnergyValueRegistry;
|
import com.pahimar.ee3.exchange.WrappedStack;
|
||||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
|
|
@ -1,20 +1,17 @@
|
||||||
package com.pahimar.ee3.api.exchange;
|
package com.pahimar.ee3.exchange;
|
||||||
|
|
||||||
public class EnergyComponent implements Comparable<EnergyComponent>
|
public class EnergyComponent implements Comparable<EnergyComponent>
|
||||||
{
|
{
|
||||||
|
|
||||||
public final EnergyType type;
|
public final EnergyType type;
|
||||||
public final int weight;
|
public final int weight;
|
||||||
|
|
||||||
public EnergyComponent(EnergyType type)
|
public EnergyComponent(EnergyType type)
|
||||||
{
|
{
|
||||||
|
|
||||||
this(type, 1);
|
this(type, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public EnergyComponent(EnergyType type, int weight)
|
public EnergyComponent(EnergyType type, int weight)
|
||||||
{
|
{
|
||||||
|
|
||||||
this.type = type;
|
this.type = type;
|
||||||
|
|
||||||
if (weight > 0)
|
if (weight > 0)
|
||||||
|
@ -30,7 +27,6 @@ public class EnergyComponent implements Comparable<EnergyComponent>
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object object)
|
public boolean equals(Object object)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!(object instanceof EnergyComponent))
|
if (!(object instanceof EnergyComponent))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
@ -50,7 +46,6 @@ public class EnergyComponent implements Comparable<EnergyComponent>
|
||||||
@Override
|
@Override
|
||||||
public int compareTo(EnergyComponent energyComponent)
|
public int compareTo(EnergyComponent energyComponent)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (energyComponent != null)
|
if (energyComponent != null)
|
||||||
{
|
{
|
||||||
if (this.type == energyComponent.type)
|
if (this.type == energyComponent.type)
|
|
@ -1,4 +1,4 @@
|
||||||
package com.pahimar.ee3.api.exchange;
|
package com.pahimar.ee3.exchange;
|
||||||
|
|
||||||
public enum EnergyType
|
public enum EnergyType
|
||||||
{
|
{
|
|
@ -1,19 +1,13 @@
|
||||||
package com.pahimar.ee3.api.exchange;
|
package com.pahimar.ee3.exchange;
|
||||||
|
|
||||||
import com.google.gson.*;
|
|
||||||
import com.pahimar.ee3.util.LogHelper;
|
|
||||||
|
|
||||||
import java.lang.reflect.Type;
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class EnergyValue implements Comparable<EnergyValue>, JsonDeserializer<EnergyValue>, JsonSerializer<EnergyValue>
|
public class EnergyValue implements Comparable<EnergyValue>
|
||||||
{
|
{
|
||||||
// Gson serializer for serializing to/deserializing from json
|
|
||||||
private static final Gson gsonSerializer = (new GsonBuilder()).registerTypeAdapter(EnergyValue.class, new EnergyValue()).create();
|
|
||||||
private static final int PRECISION = 4;
|
private static final int PRECISION = 4;
|
||||||
|
|
||||||
public final float[] components;
|
public final float[] components;
|
||||||
|
@ -140,32 +134,6 @@ public class EnergyValue implements Comparable<EnergyValue>, JsonDeserializer<En
|
||||||
this((float) value, componentList);
|
this((float) value, componentList);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Deserializes an EnergyValue object from the given serialized json String
|
|
||||||
*
|
|
||||||
* @param jsonEnergyValue Json encoded String representing a EnergyValue object
|
|
||||||
* @return The EnergyValue that was encoded as json, or null if a valid EnergyValue could not be decoded from given
|
|
||||||
* String
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("unused")
|
|
||||||
public static EnergyValue createFromJson(String jsonEnergyValue)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
return gsonSerializer.fromJson(jsonEnergyValue, EnergyValue.class);
|
|
||||||
}
|
|
||||||
catch (JsonSyntaxException exception)
|
|
||||||
{
|
|
||||||
LogHelper.error(exception.getMessage());
|
|
||||||
}
|
|
||||||
catch (JsonParseException exception)
|
|
||||||
{
|
|
||||||
LogHelper.error(exception.getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode()
|
public int hashCode()
|
||||||
{
|
{
|
||||||
|
@ -252,59 +220,4 @@ public class EnergyValue implements Comparable<EnergyValue>, JsonDeserializer<En
|
||||||
throw new ArrayIndexOutOfBoundsException();
|
throw new ArrayIndexOutOfBoundsException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns this EnergyValue as a json serialized String
|
|
||||||
*
|
|
||||||
* @return Json serialized String of this EnergyValue
|
|
||||||
*/
|
|
||||||
public String toJson()
|
|
||||||
{
|
|
||||||
return gsonSerializer.toJson(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public JsonElement serialize(EnergyValue exchangeEnergyValue, Type type, JsonSerializationContext context)
|
|
||||||
{
|
|
||||||
JsonObject jsonEnergyValue = new JsonObject();
|
|
||||||
|
|
||||||
for (EnergyType energyType : EnergyType.TYPES)
|
|
||||||
{
|
|
||||||
jsonEnergyValue.addProperty(energyType.toString(), exchangeEnergyValue.components[energyType.ordinal()]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return jsonEnergyValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnergyValue deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext context) throws JsonParseException
|
|
||||||
{
|
|
||||||
|
|
||||||
float[] energyValueComponents = new float[EnergyType.TYPES.length];
|
|
||||||
JsonObject jsonEnergyValue = (JsonObject) jsonElement;
|
|
||||||
|
|
||||||
for (EnergyType energyType : EnergyType.TYPES)
|
|
||||||
{
|
|
||||||
if ((jsonEnergyValue.get(energyType.toString()) != null) && (jsonEnergyValue.get(energyType.toString()).isJsonPrimitive()))
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
energyValueComponents[energyType.ordinal()] = jsonEnergyValue.get(energyType.toString()).getAsFloat();
|
|
||||||
}
|
|
||||||
catch (UnsupportedOperationException exception)
|
|
||||||
{
|
|
||||||
LogHelper.error(exception.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
EnergyValue exchangeEnergyValue = new EnergyValue(energyValueComponents);
|
|
||||||
|
|
||||||
if (exchangeEnergyValue.getValue() > 0f)
|
|
||||||
{
|
|
||||||
return exchangeEnergyValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -1,10 +1,8 @@
|
||||||
package com.pahimar.ee3.api.exchange;
|
package com.pahimar.ee3.exchange;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableSortedMap;
|
import com.google.common.collect.ImmutableSortedMap;
|
||||||
import com.pahimar.ee3.api.core.OreStack;
|
|
||||||
import com.pahimar.ee3.api.core.WrappedStack;
|
|
||||||
import com.pahimar.ee3.api.recipe.RecipeRegistry;
|
|
||||||
import com.pahimar.ee3.init.EnergyValues;
|
import com.pahimar.ee3.init.EnergyValues;
|
||||||
|
import com.pahimar.ee3.recipe.RecipeRegistry;
|
||||||
import com.pahimar.ee3.util.EnergyValueHelper;
|
import com.pahimar.ee3.util.EnergyValueHelper;
|
||||||
import com.pahimar.ee3.util.LogHelper;
|
import com.pahimar.ee3.util.LogHelper;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
|
@ -1,4 +1,4 @@
|
||||||
package com.pahimar.ee3.api.core;
|
package com.pahimar.ee3.exchange;
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraftforge.oredict.OreDictionary;
|
import net.minecraftforge.oredict.OreDictionary;
|
|
@ -1,4 +1,4 @@
|
||||||
package com.pahimar.ee3.api.core;
|
package com.pahimar.ee3.exchange;
|
||||||
|
|
||||||
import com.pahimar.ee3.util.FluidHelper;
|
import com.pahimar.ee3.util.FluidHelper;
|
||||||
import com.pahimar.ee3.util.ItemHelper;
|
import com.pahimar.ee3.util.ItemHelper;
|
|
@ -1,8 +1,8 @@
|
||||||
package com.pahimar.ee3.init;
|
package com.pahimar.ee3.init;
|
||||||
|
|
||||||
import com.pahimar.ee3.api.core.OreStack;
|
import com.pahimar.ee3.exchange.EnergyValue;
|
||||||
import com.pahimar.ee3.api.core.WrappedStack;
|
import com.pahimar.ee3.exchange.OreStack;
|
||||||
import com.pahimar.ee3.api.exchange.EnergyValue;
|
import com.pahimar.ee3.exchange.WrappedStack;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.init.Items;
|
import net.minecraft.init.Items;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package com.pahimar.ee3.init;
|
package com.pahimar.ee3.init;
|
||||||
|
|
||||||
import com.pahimar.ee3.api.recipe.RecipesAludel;
|
import com.pahimar.ee3.recipe.RecipesAludel;
|
||||||
import com.pahimar.ee3.util.CraftingHelper;
|
import com.pahimar.ee3.util.CraftingHelper;
|
||||||
import cpw.mods.fml.common.registry.GameRegistry;
|
import cpw.mods.fml.common.registry.GameRegistry;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package com.pahimar.ee3.api.recipe;
|
package com.pahimar.ee3.item.crafting;
|
||||||
|
|
||||||
import com.pahimar.ee3.api.core.OreStack;
|
import com.pahimar.ee3.exchange.OreStack;
|
||||||
import com.pahimar.ee3.api.core.WrappedStack;
|
import com.pahimar.ee3.exchange.WrappedStack;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraftforge.oredict.OreDictionary;
|
import net.minecraftforge.oredict.OreDictionary;
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
package com.pahimar.ee3.api.recipe;
|
package com.pahimar.ee3.recipe;
|
||||||
|
|
||||||
import com.google.common.collect.HashMultimap;
|
import com.google.common.collect.HashMultimap;
|
||||||
import com.google.common.collect.Multimap;
|
import com.google.common.collect.Multimap;
|
||||||
import com.pahimar.ee3.api.core.WrappedStack;
|
import com.pahimar.ee3.exchange.WrappedStack;
|
||||||
import com.pahimar.ee3.recipe.RecipesFluidContainers;
|
import com.pahimar.ee3.item.crafting.RecipeAludel;
|
||||||
import com.pahimar.ee3.recipe.RecipesPotions;
|
|
||||||
import com.pahimar.ee3.recipe.RecipesVanilla;
|
|
||||||
import com.pahimar.ee3.util.LogHelper;
|
import com.pahimar.ee3.util.LogHelper;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
|
@ -1,6 +1,7 @@
|
||||||
package com.pahimar.ee3.api.recipe;
|
package com.pahimar.ee3.recipe;
|
||||||
|
|
||||||
import com.pahimar.ee3.api.core.OreStack;
|
import com.pahimar.ee3.exchange.OreStack;
|
||||||
|
import com.pahimar.ee3.item.crafting.RecipeAludel;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
|
@ -2,7 +2,7 @@ package com.pahimar.ee3.recipe;
|
||||||
|
|
||||||
import com.google.common.collect.HashMultimap;
|
import com.google.common.collect.HashMultimap;
|
||||||
import com.google.common.collect.Multimap;
|
import com.google.common.collect.Multimap;
|
||||||
import com.pahimar.ee3.api.core.WrappedStack;
|
import com.pahimar.ee3.exchange.WrappedStack;
|
||||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||||
import net.minecraftforge.fluids.FluidContainerRegistry.FluidContainerData;
|
import net.minecraftforge.fluids.FluidContainerRegistry.FluidContainerData;
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ package com.pahimar.ee3.recipe;
|
||||||
|
|
||||||
import com.google.common.collect.HashMultimap;
|
import com.google.common.collect.HashMultimap;
|
||||||
import com.google.common.collect.Multimap;
|
import com.google.common.collect.Multimap;
|
||||||
import com.pahimar.ee3.api.core.WrappedStack;
|
import com.pahimar.ee3.exchange.WrappedStack;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.init.Items;
|
import net.minecraft.init.Items;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
|
@ -2,7 +2,7 @@ package com.pahimar.ee3.recipe;
|
||||||
|
|
||||||
import com.google.common.collect.HashMultimap;
|
import com.google.common.collect.HashMultimap;
|
||||||
import com.google.common.collect.Multimap;
|
import com.google.common.collect.Multimap;
|
||||||
import com.pahimar.ee3.api.core.WrappedStack;
|
import com.pahimar.ee3.exchange.WrappedStack;
|
||||||
import com.pahimar.ee3.util.RecipeHelper;
|
import com.pahimar.ee3.util.RecipeHelper;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.crafting.CraftingManager;
|
import net.minecraft.item.crafting.CraftingManager;
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
package com.pahimar.ee3.skill;
|
package com.pahimar.ee3.skill;
|
||||||
|
|
||||||
import com.pahimar.ee3.init.Skills;
|
|
||||||
import com.pahimar.ee3.util.ItemHelper;
|
import com.pahimar.ee3.util.ItemHelper;
|
||||||
import com.pahimar.ee3.util.LogHelper;
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
@ -33,45 +31,53 @@ public class SkillRegistry
|
||||||
private void init()
|
private void init()
|
||||||
{
|
{
|
||||||
skillMap = new TreeMap<ItemStack, Skill>(ItemHelper.comparator);
|
skillMap = new TreeMap<ItemStack, Skill>(ItemHelper.comparator);
|
||||||
Skills.addDefaultSkills();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean addSkill(Item item)
|
public void addSkill(Item item)
|
||||||
{
|
{
|
||||||
return addSkill(new ItemStack(item));
|
addSkill(new ItemStack(item));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean addSkill(Block block)
|
public void addSkill(ItemStack itemStack)
|
||||||
{
|
{
|
||||||
return addSkill(new ItemStack(block));
|
addSkill(itemStack, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean addSkill(ItemStack itemStack)
|
public void addSkill(ItemStack itemStack, boolean learnable, boolean recoverable)
|
||||||
{
|
{
|
||||||
return addSkill(itemStack, true, true);
|
addSkill(itemStack, new Skill(learnable, recoverable));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean addSkill(ItemStack itemStack, boolean learnable, boolean recoverable)
|
private void addSkill(ItemStack itemStack, Skill skill)
|
||||||
{
|
|
||||||
return addSkill(itemStack, new Skill(learnable, recoverable));
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean addSkill(ItemStack itemStack, Skill skill)
|
|
||||||
{
|
{
|
||||||
if (!skillMap.containsKey(itemStack))
|
if (!skillMap.containsKey(itemStack))
|
||||||
{
|
{
|
||||||
skillMap.put(itemStack, skill);
|
skillMap.put(itemStack, skill);
|
||||||
return true;
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addSkill(Block block)
|
||||||
|
{
|
||||||
|
addSkill(new ItemStack(block));
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isLearnable(ItemStack itemStack)
|
||||||
|
{
|
||||||
|
if (skillMap.containsKey(itemStack))
|
||||||
|
{
|
||||||
|
return skillMap.get(itemStack).isLearnable();
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void dumpSkillSet()
|
public boolean isRecoverable(ItemStack itemStack)
|
||||||
{
|
{
|
||||||
for (ItemStack itemStack : skillMap.keySet())
|
if (skillMap.containsKey(itemStack))
|
||||||
{
|
{
|
||||||
LogHelper.info(String.format("%s: %s", ItemHelper.toString(itemStack), skillMap.get(itemStack)));
|
return skillMap.get(itemStack).isRecoverable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package com.pahimar.ee3.thread;
|
package com.pahimar.ee3.thread;
|
||||||
|
|
||||||
import com.pahimar.ee3.api.exchange.EnergyValueRegistry;
|
import com.pahimar.ee3.exchange.EnergyValueRegistry;
|
||||||
import com.pahimar.ee3.util.LogHelper;
|
import com.pahimar.ee3.util.LogHelper;
|
||||||
|
|
||||||
public class DynamicEnergyValueInitThread implements Runnable
|
public class DynamicEnergyValueInitThread implements Runnable
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
package com.pahimar.ee3.tileentity;
|
package com.pahimar.ee3.tileentity;
|
||||||
|
|
||||||
import com.pahimar.ee3.api.recipe.RecipeAludel;
|
|
||||||
import com.pahimar.ee3.api.recipe.RecipesAludel;
|
|
||||||
import com.pahimar.ee3.item.ItemAlchemicalDust;
|
import com.pahimar.ee3.item.ItemAlchemicalDust;
|
||||||
|
import com.pahimar.ee3.item.crafting.RecipeAludel;
|
||||||
import com.pahimar.ee3.network.PacketHandler;
|
import com.pahimar.ee3.network.PacketHandler;
|
||||||
import com.pahimar.ee3.network.message.MessageTileEntityAludel;
|
import com.pahimar.ee3.network.message.MessageTileEntityAludel;
|
||||||
|
import com.pahimar.ee3.recipe.RecipesAludel;
|
||||||
import com.pahimar.ee3.reference.Names;
|
import com.pahimar.ee3.reference.Names;
|
||||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package com.pahimar.ee3.util;
|
package com.pahimar.ee3.util;
|
||||||
|
|
||||||
import com.pahimar.ee3.api.exchange.EnergyValue;
|
import com.pahimar.ee3.exchange.EnergyValue;
|
||||||
import com.pahimar.ee3.api.exchange.EnergyValueRegistry;
|
import com.pahimar.ee3.exchange.EnergyValueRegistry;
|
||||||
import com.pahimar.ee3.init.ModItems;
|
import com.pahimar.ee3.init.ModItems;
|
||||||
import com.pahimar.ee3.item.ItemAlchemicalDust;
|
import com.pahimar.ee3.item.ItemAlchemicalDust;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
package com.pahimar.ee3.util;
|
package com.pahimar.ee3.util;
|
||||||
|
|
||||||
import com.pahimar.ee3.api.core.WrappedStack;
|
import com.pahimar.ee3.exchange.EnergyType;
|
||||||
import com.pahimar.ee3.api.exchange.EnergyType;
|
import com.pahimar.ee3.exchange.EnergyValue;
|
||||||
import com.pahimar.ee3.api.exchange.EnergyValue;
|
import com.pahimar.ee3.exchange.EnergyValueRegistry;
|
||||||
import com.pahimar.ee3.api.exchange.EnergyValueRegistry;
|
import com.pahimar.ee3.exchange.WrappedStack;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package com.pahimar.ee3.util;
|
package com.pahimar.ee3.util;
|
||||||
|
|
||||||
import com.pahimar.ee3.api.core.OreStack;
|
import com.pahimar.ee3.exchange.OreStack;
|
||||||
import com.pahimar.ee3.api.core.WrappedStack;
|
import com.pahimar.ee3.exchange.WrappedStack;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.crafting.IRecipe;
|
import net.minecraft.item.crafting.IRecipe;
|
||||||
import net.minecraft.item.crafting.ShapedRecipes;
|
import net.minecraft.item.crafting.ShapedRecipes;
|
||||||
|
|
Loading…
Reference in a new issue