Resource generator now generates only when ore and ingot are present
This commit is contained in:
parent
3f122cd2dd
commit
4ed2a4b424
4 changed files with 144 additions and 135 deletions
|
@ -88,8 +88,7 @@ public class FluidPressureNode extends Node<IPressureNodeProvider, TickingGrid,
|
|||
|
||||
public void distribute()
|
||||
{
|
||||
synchronized (getConnections())
|
||||
{
|
||||
|
||||
Iterator<Entry<Object, ForgeDirection>> it = getConnections().entrySet().iterator();
|
||||
|
||||
while (it.hasNext())
|
||||
|
@ -179,7 +178,6 @@ public class FluidPressureNode extends Node<IPressureNodeProvider, TickingGrid,
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int getMaxFlowRate()
|
||||
{
|
||||
|
|
|
@ -176,7 +176,7 @@ public class ItemOreResource extends Item
|
|||
@Override
|
||||
public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List)
|
||||
{
|
||||
for (String materialName : ResourceGenerator.getMaterials())
|
||||
for (String materialName : ResourceGenerator.materials.keySet())
|
||||
{
|
||||
par3List.add(getStackFromMaterial(materialName));
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import java.io.File;
|
|||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
|
@ -65,7 +66,7 @@ public class ResourceGenerator implements IVirtualObject
|
|||
* Name, ID
|
||||
*/
|
||||
static int maxID = 0;
|
||||
static final HashBiMap<String, Integer> materials = HashBiMap.create();
|
||||
public static final HashBiMap<String, Integer> materials = HashBiMap.create();
|
||||
|
||||
static final HashMap<String, Integer> materialColorCache = new HashMap<String, Integer>();
|
||||
static final HashMap<Icon, Integer> iconColorCache = new HashMap<Icon, Integer>();
|
||||
|
@ -73,11 +74,12 @@ public class ResourceGenerator implements IVirtualObject
|
|||
static
|
||||
{
|
||||
OreDetectionBlackList.addIngot("ingotRefinedIron");
|
||||
OreDetectionBlackList.addIngot("uranium");
|
||||
OreDetectionBlackList.addIngot("ingotUranium");
|
||||
SaveManager.registerClass("resourceGenerator", ResourceGenerator.class);
|
||||
SaveManager.register(INSTANCE);
|
||||
}
|
||||
|
||||
// TODO: Generate teh resource here instead of elsewhere...
|
||||
@ForgeSubscribe
|
||||
public void oreRegisterEvent(OreRegisterEvent evt)
|
||||
{
|
||||
|
@ -100,44 +102,18 @@ public class ResourceGenerator implements IVirtualObject
|
|||
}
|
||||
}
|
||||
|
||||
public static void generateOreResources()
|
||||
{
|
||||
OreDictionary.registerOre("ingotGold", Item.ingotGold);
|
||||
OreDictionary.registerOre("ingotIron", Item.ingotIron);
|
||||
|
||||
OreDictionary.registerOre("oreGold", Block.oreGold);
|
||||
OreDictionary.registerOre("oreIron", Block.oreIron);
|
||||
OreDictionary.registerOre("oreLapis", Block.oreLapis);
|
||||
regenerateOreResources();
|
||||
}
|
||||
|
||||
public static void regenerateOreResources()
|
||||
{
|
||||
// Vanilla fluid recipes
|
||||
MachineRecipes.INSTANCE.addRecipe(RecipeType.SMELTER, new FluidStack(FluidRegistry.LAVA, FluidContainerRegistry.BUCKET_VOLUME), new ItemStack(Block.stone));
|
||||
|
||||
// Vanilla crusher recipes
|
||||
MachineRecipes.INSTANCE.addRecipe(RecipeType.CRUSHER, Block.cobblestone, Block.gravel);
|
||||
MachineRecipes.INSTANCE.addRecipe(RecipeType.CRUSHER, Block.stone, Block.cobblestone);
|
||||
MachineRecipes.INSTANCE.addRecipe(RecipeType.CRUSHER, Block.chest, new ItemStack(Block.planks, 7, 0));
|
||||
|
||||
// Vanilla grinder recipes
|
||||
MachineRecipes.INSTANCE.addRecipe(RecipeType.GRINDER, Block.cobblestone, Block.sand);
|
||||
MachineRecipes.INSTANCE.addRecipe(RecipeType.GRINDER, Block.gravel, Block.sand);
|
||||
MachineRecipes.INSTANCE.addRecipe(RecipeType.GRINDER, Block.glass, Block.sand);
|
||||
|
||||
for (String materialName : materials.keySet())
|
||||
public static void generate(String materialName)
|
||||
{
|
||||
// Caps version of the name
|
||||
String nameCaps = LanguageUtility.capitalizeFirst(materialName);
|
||||
String localizedName = materialName;
|
||||
|
||||
List<ItemStack> list = OreDictionary.getOres("ingot" + materialName.substring(0, 1).toUpperCase() + materialName.substring(1));
|
||||
List<ItemStack> list = OreDictionary.getOres("ingot" + nameCaps);
|
||||
|
||||
if (list.size() > 0)
|
||||
{
|
||||
ItemStack type = list.get(0);
|
||||
localizedName = type.getDisplayName();
|
||||
localizedName = type.getDisplayName().trim();
|
||||
|
||||
if (LanguageUtility.getLocal(localizedName) != null && LanguageUtility.getLocal(localizedName) != "")
|
||||
{
|
||||
|
@ -198,6 +174,40 @@ public class ResourceGenerator implements IVirtualObject
|
|||
MachineRecipes.INSTANCE.addRecipe(RecipeType.CRUSHER, "ore" + nameCaps, "rubble" + nameCaps);
|
||||
}
|
||||
}
|
||||
|
||||
public static void generateOreResources()
|
||||
{
|
||||
OreDictionary.registerOre("ingotGold", Item.ingotGold);
|
||||
OreDictionary.registerOre("ingotIron", Item.ingotIron);
|
||||
|
||||
OreDictionary.registerOre("oreGold", Block.oreGold);
|
||||
OreDictionary.registerOre("oreIron", Block.oreIron);
|
||||
OreDictionary.registerOre("oreLapis", Block.oreLapis);
|
||||
|
||||
// Vanilla fluid recipes
|
||||
MachineRecipes.INSTANCE.addRecipe(RecipeType.SMELTER, new FluidStack(FluidRegistry.LAVA, FluidContainerRegistry.BUCKET_VOLUME), new ItemStack(Block.stone));
|
||||
|
||||
// Vanilla crusher recipes
|
||||
MachineRecipes.INSTANCE.addRecipe(RecipeType.CRUSHER, Block.cobblestone, Block.gravel);
|
||||
MachineRecipes.INSTANCE.addRecipe(RecipeType.CRUSHER, Block.stone, Block.cobblestone);
|
||||
MachineRecipes.INSTANCE.addRecipe(RecipeType.CRUSHER, Block.chest, new ItemStack(Block.planks, 7, 0));
|
||||
|
||||
// Vanilla grinder recipes
|
||||
MachineRecipes.INSTANCE.addRecipe(RecipeType.GRINDER, Block.cobblestone, Block.sand);
|
||||
MachineRecipes.INSTANCE.addRecipe(RecipeType.GRINDER, Block.gravel, Block.sand);
|
||||
MachineRecipes.INSTANCE.addRecipe(RecipeType.GRINDER, Block.glass, Block.sand);
|
||||
|
||||
Iterator<String> it = materials.keySet().iterator();
|
||||
while (it.hasNext())
|
||||
{
|
||||
String materialName = it.next();
|
||||
String nameCaps = LanguageUtility.capitalizeFirst(materialName);
|
||||
|
||||
if (OreDictionary.getOres("ore" + nameCaps).size() > 0)
|
||||
generate(materialName);
|
||||
else
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
|
||||
@ForgeSubscribe
|
||||
|
@ -380,6 +390,7 @@ public class ResourceGenerator implements IVirtualObject
|
|||
return 0xFFFFFF;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static List<String> getMaterials()
|
||||
{
|
||||
List<String> returnMaterials = new ArrayList<String>();
|
||||
|
|
|
@ -271,7 +271,7 @@ public class ItemOreResourceBucket extends Item
|
|||
@Override
|
||||
public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List)
|
||||
{
|
||||
for (String materialName : ResourceGenerator.getMaterials())
|
||||
for (String materialName : ResourceGenerator.materials.keySet())
|
||||
{
|
||||
par3List.add(getStackFromMaterial(materialName));
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue