Added manual ore dust washing with cauldron
This commit is contained in:
parent
f69f928cc0
commit
2e36f323e6
3 changed files with 57 additions and 0 deletions
|
@ -13,6 +13,7 @@ import net.minecraft.block.Block;
|
|||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.FurnaceRecipes;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.event.TextureStitchEvent;
|
||||
|
@ -77,6 +78,12 @@ public class ResourceGenerator
|
|||
MachineRecipes.INSTANCE.addRecipe(RecipeType.CRUSHER, "ore" + name, "rubble" + name);
|
||||
MachineRecipes.INSTANCE.addRecipe(RecipeType.GRINDER, "rubble" + name, "dust" + name, "dust" + name);
|
||||
MachineRecipes.INSTANCE.addRecipe(RecipeType.MIXER, "dust" + name, "dustRefined" + name);
|
||||
MachineRecipes.INSTANCE.addRecipe(RecipeType.SMELTER, "dustRefined" + name, "ingot" + name);
|
||||
|
||||
ItemStack dust = OreDictionary.getOres("dust" + name).get(0);
|
||||
FurnaceRecipes.smelting().addSmelting(dust.itemID, dust.getItemDamage(), OreDictionary.getOres("ingot" + name).get(0), 0.7f);
|
||||
ItemStack refinedDust = OreDictionary.getOres("dustRefined" + name).get(0);
|
||||
FurnaceRecipes.smelting().addSmelting(refinedDust.itemID, refinedDust.getItemDamage(), OreDictionary.getOres("ingot" + name).get(0), 0.7f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,13 +2,21 @@ package resonantinduction.core.resource.item;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import resonantinduction.api.recipe.MachineRecipes;
|
||||
import resonantinduction.api.recipe.MachineRecipes.RecipeType;
|
||||
import resonantinduction.api.recipe.RecipeUtils.Resource;
|
||||
import resonantinduction.core.prefab.item.ItemRI;
|
||||
import resonantinduction.core.resource.ResourceGenerator;
|
||||
import universalelectricity.api.vector.Vector3;
|
||||
import calclavia.lib.utility.LanguageUtility;
|
||||
import calclavia.lib.utility.inventory.InventoryUtility;
|
||||
import calclavia.lib.utility.nbt.NBTUtility;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
@ -45,6 +53,47 @@ public class ItemOreResource extends ItemRI
|
|||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
/**
|
||||
* Manually wash dust into refined dust.
|
||||
*/
|
||||
Resource[] outputs = MachineRecipes.INSTANCE.getOutput(RecipeType.MIXER, stack);
|
||||
|
||||
if (outputs.length > 0)
|
||||
{
|
||||
int blockId = world.getBlockId(x, y, z);
|
||||
int metadata = world.getBlockMetadata(x, y, z);
|
||||
Block block = Block.blocksList[blockId];
|
||||
|
||||
if (block == Block.cauldron)
|
||||
{
|
||||
if (metadata > 0)
|
||||
{
|
||||
if (world.rand.nextFloat() > 0.9)
|
||||
{
|
||||
for (Resource res : outputs)
|
||||
{
|
||||
InventoryUtility.dropItemStack(world, new Vector3(player), res.getItemStack().copy(), 0);
|
||||
}
|
||||
|
||||
stack.splitStack(1);
|
||||
|
||||
if (stack.stackSize <= 0)
|
||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
|
||||
}
|
||||
|
||||
world.setBlockMetadataWithNotify(x, y, z, metadata - 1, 3);
|
||||
world.playSoundEffect(x + 0.5, y + 0.5, z + 0.5, "liquid.water", 0.5f, 1);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public ItemStack getStackFromDust(String name)
|
||||
{
|
||||
ItemStack itemStack = new ItemStack(this);
|
||||
|
|
|
@ -13,6 +13,7 @@ fluid.mixture=Mixture
|
|||
misc.resonantinduction.ingot=Ingot
|
||||
item.resonantinduction\:ingot.name=%v Ingot
|
||||
item.resonantinduction\:oreDust.name=%v Dust
|
||||
item.resonantinduction\:oreDust.tooltip=Shift-right click on a cauldron to refine.
|
||||
item.resonantinduction\:oreRefinedDust.name=%v Refined Dust
|
||||
item.resonantinduction\:oreRubble.name=%v Rubble
|
||||
|
||||
|
|
Loading…
Reference in a new issue