Fixed some resource generator and liquid issues
This commit is contained in:
parent
143e6d00e7
commit
1c56fba9bc
6 changed files with 82 additions and 16 deletions
|
@ -55,6 +55,8 @@ public class BlockFilter extends BlockTile
|
|||
Block bAbove = Block.blocksList[checkAbove.getBlockID(world)];
|
||||
Block bBelow = Block.blocksList[checkAbove.getBlockID(world)];
|
||||
|
||||
world.scheduleBlockUpdate(x, y, z, blockID, 20);
|
||||
|
||||
if (bAbove instanceof BlockFluidMixture && (world.isAirBlock(checkBelow.intX(), checkBelow.intY(), checkBelow.intZ()) || checkBelow.getTileEntity(world) instanceof IFluidHandler))
|
||||
{
|
||||
world.spawnParticle("dripWater", x + 0.5, y, z + 0.5, 0, 0, 0);
|
||||
|
@ -77,7 +79,7 @@ public class BlockFilter extends BlockTile
|
|||
/**
|
||||
* Drop item from fluid.
|
||||
*/
|
||||
for (RecipeResource resoure : MachineRecipes.INSTANCE.getOutput(RecipeType.MIXER, "dust" + ResourceGenerator.mixtureToMaterial(fluidBlock.getFluid().getName())))
|
||||
for (RecipeResource resoure : MachineRecipes.INSTANCE.getOutput(RecipeType.MIXER, "dust" + LanguageUtility.capitalizeFirst(ResourceGenerator.mixtureToMaterial(fluidBlock.getFluid().getName()))))
|
||||
{
|
||||
InventoryUtility.dropItemStack(world, checkAbove.clone().add(0.5), resoure.getItemStack().copy());
|
||||
}
|
||||
|
@ -104,6 +106,7 @@ public class BlockFilter extends BlockTile
|
|||
checkBelow.setBlock(world, Block.waterMoving.blockID);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package resonantinduction.core;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
|
@ -8,6 +9,7 @@ import net.minecraft.block.Block;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
|
||||
import org.modstats.ModstatInfo;
|
||||
import org.modstats.Modstats;
|
||||
|
@ -75,8 +77,8 @@ public class ResonantInduction
|
|||
public static ItemOreResource itemRubble, itemDust, itemRefinedDust;
|
||||
public static ItemOreResourceBucket itemBucketMixture, itemBucketMolten;
|
||||
public static Block blockDust;
|
||||
public static final List<Block> blockMixtureFluids = new ArrayList<Block>();
|
||||
public static final List<Block> blockMoltenFluid = new ArrayList<Block>();
|
||||
public static final HashMap<Integer, Block> blockMixtureFluids = new HashMap<Integer, Block>();
|
||||
public static final HashMap<Integer, Block> blockMoltenFluid = new HashMap<Integer, Block>();
|
||||
public static Block blockMachinePart;
|
||||
|
||||
public static List<Fluid> fluidMixtures = new ArrayList<Fluid>();
|
||||
|
|
|
@ -26,10 +26,10 @@ public class NEIResonantInductionConfig implements IConfigureNEI
|
|||
API.registerRecipeHandler(new RISmelterRecipeHandler());
|
||||
API.registerUsageHandler(new RISmelterRecipeHandler());
|
||||
|
||||
for (Block block : ResonantInduction.blockMixtureFluids)
|
||||
for (Block block : ResonantInduction.blockMixtureFluids.values())
|
||||
API.hideItem(block.blockID);
|
||||
|
||||
for (Block block : ResonantInduction.blockMoltenFluid)
|
||||
for (Block block : ResonantInduction.blockMoltenFluid.values())
|
||||
API.hideItem(block.blockID);
|
||||
|
||||
API.hideItem(ResonantInduction.blockDust.blockID);
|
||||
|
|
|
@ -2,10 +2,12 @@ package resonantinduction.core.resource;
|
|||
|
||||
import java.awt.Color;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
|
||||
|
@ -14,6 +16,8 @@ import net.minecraft.client.Minecraft;
|
|||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.FurnaceRecipes;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.event.TextureStitchEvent;
|
||||
|
@ -33,6 +37,9 @@ import resonantinduction.core.Settings;
|
|||
import resonantinduction.core.resource.fluid.BlockFluidMaterial;
|
||||
import resonantinduction.core.resource.fluid.BlockFluidMixture;
|
||||
import calclavia.lib.utility.LanguageUtility;
|
||||
import calclavia.lib.utility.nbt.IVirtualObject;
|
||||
import calclavia.lib.utility.nbt.NBTUtility;
|
||||
import calclavia.lib.utility.nbt.SaveManager;
|
||||
|
||||
import com.google.common.collect.HashBiMap;
|
||||
|
||||
|
@ -41,7 +48,7 @@ import cpw.mods.fml.relauncher.Side;
|
|||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
/** @author Calclavia */
|
||||
public class ResourceGenerator
|
||||
public class ResourceGenerator implements IVirtualObject
|
||||
{
|
||||
public static final ResourceGenerator INSTANCE = new ResourceGenerator();
|
||||
|
||||
|
@ -59,7 +66,8 @@ public class ResourceGenerator
|
|||
|
||||
static
|
||||
{
|
||||
OreDetectionBlackList.addIngot("refinedIron");
|
||||
OreDetectionBlackList.addIngot("ingotRefinedIron");
|
||||
SaveManager.register(INSTANCE);
|
||||
}
|
||||
|
||||
@ForgeSubscribe
|
||||
|
@ -119,14 +127,16 @@ public class ResourceGenerator
|
|||
FluidRegistry.registerFluid(fluidMolten);
|
||||
Block blockFluidMaterial = new BlockFluidMaterial(fluidMolten);
|
||||
GameRegistry.registerBlock(blockFluidMaterial, "molten" + nameCaps);
|
||||
ResonantInduction.blockMoltenFluid.add(blockFluidMaterial);
|
||||
ResonantInduction.blockMoltenFluid.put(getID(materialName), blockFluidMaterial);
|
||||
FluidContainerRegistry.registerFluidContainer(fluidMolten, ResonantInduction.itemBucketMolten.getStackFromMaterial(materialName));
|
||||
|
||||
/** Generate dust mixture fluids */
|
||||
Fluid fluidMixture = new Fluid(materialNameToMixture(materialName));
|
||||
FluidRegistry.registerFluid(fluidMixture);
|
||||
Block blockFluidMixture = new BlockFluidMixture(fluidMixture);
|
||||
GameRegistry.registerBlock(blockFluidMixture, "mixture" + nameCaps);
|
||||
ResonantInduction.blockMixtureFluids.add(blockFluidMixture);
|
||||
ResonantInduction.blockMixtureFluids.put(getID(materialName), blockFluidMixture);
|
||||
FluidContainerRegistry.registerFluidContainer(fluidMixture, ResonantInduction.itemBucketMixture.getStackFromMaterial(materialName));
|
||||
|
||||
if (OreDictionary.getOres("ore" + nameCaps).size() > 0)
|
||||
{
|
||||
|
@ -279,7 +289,7 @@ public class ResourceGenerator
|
|||
|
||||
public static String fluidNameToMaterial(String fluidName, String type)
|
||||
{
|
||||
return LanguageUtility.underscoreToCamel(fluidName).replace(type, "");
|
||||
return LanguageUtility.decapitalizeFirst(LanguageUtility.underscoreToCamel(fluidName).replace(type, ""));
|
||||
}
|
||||
|
||||
public static String materialNameToFluid(String materialName, String type)
|
||||
|
@ -323,8 +333,59 @@ public class ResourceGenerator
|
|||
return 0xFFFFFF;
|
||||
}
|
||||
|
||||
public static Set<String> getMaterials()
|
||||
public static List<String> getMaterials()
|
||||
{
|
||||
return materials.keySet();
|
||||
List<String> returnMaterials = new ArrayList<String>();
|
||||
|
||||
for (int i = 0; i < materials.size(); i++)
|
||||
{
|
||||
returnMaterials.add(getName(i));
|
||||
}
|
||||
|
||||
return returnMaterials;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save(NBTTagCompound nbt)
|
||||
{
|
||||
NBTTagList list = new NBTTagList();
|
||||
|
||||
for (Entry<String, Integer> entry : materials.entrySet())
|
||||
{
|
||||
NBTTagCompound node = new NBTTagCompound();
|
||||
node.setString("materialName", entry.getKey());
|
||||
node.setInteger("materialID", entry.getValue());
|
||||
list.appendTag(node);
|
||||
}
|
||||
|
||||
nbt.setTag("materialIDMap", list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load(NBTTagCompound nbt)
|
||||
{
|
||||
if (nbt.hasKey("materialIDMap"))
|
||||
{
|
||||
materials.clear();
|
||||
NBTTagList nbtList = nbt.getTagList("materialIDMap");
|
||||
|
||||
for (int i = 0; i < nbtList.tagCount(); ++i)
|
||||
{
|
||||
NBTTagCompound node = (NBTTagCompound) nbtList.tagAt(i);
|
||||
materials.put(node.getString("materialName"), node.getInteger("materialID"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public File getSaveFile()
|
||||
{
|
||||
return new File(NBTUtility.getSaveDirectory(), "Resource_Generator.dat");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSaveFile(File file)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ public class BlockFluidMixture extends BlockFluidFinite
|
|||
@Override
|
||||
public int colorMultiplier(IBlockAccess access, int x, int y, int z)
|
||||
{
|
||||
return ResourceGenerator.getColor(getFluid().getName().replace("mixture", ""));
|
||||
return ResourceGenerator.getColor(ResourceGenerator.mixtureToMaterial(getFluid().getName()));
|
||||
}
|
||||
|
||||
public boolean mix(World world, int x, int y, int z, ItemStack stack)
|
||||
|
|
|
@ -64,7 +64,7 @@ public class ItemOreResourceBucket extends Item
|
|||
return (LanguageUtility.getLocal(this.getUnlocalizedName() + ".name")).replace("%v", name).replace(" ", " ");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return (FluidRegistry.getFluid(ResourceGenerator.materialNameToMixture(getMaterialFromStack(is))).getLocalizedName() + " Bucket");
|
||||
}
|
||||
return null;
|
||||
|
@ -253,7 +253,7 @@ public class ItemOreResourceBucket extends Item
|
|||
world.destroyBlock(x, y, z, true);
|
||||
}
|
||||
|
||||
world.setBlock(x, y, z, fluidID, 0, 3);
|
||||
world.setBlock(x, y, z, fluidID, 8, 3);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue