Added in awesome smelting code for fire staff!
This commit is contained in:
parent
e8b4d9ad2a
commit
ed93305639
4 changed files with 31 additions and 76 deletions
|
|
@ -70,6 +70,12 @@ public class RecipeManager
|
|||
FurnaceRecipes.smelting().addSmelting(BlockHandler.BlockBase.blockID, 0, new ItemStack(ItemHandler.Resource, 1, 2), 0.9F);
|
||||
FurnaceRecipes.smelting().addSmelting(BlockHandler.BlockBase.blockID, 3, new ItemStack(ItemHandler.Resource, 1, 1), 0.7F);
|
||||
FurnaceRecipes.smelting().addSmelting(BlockHandler.BlockBase.blockID, 6, new ItemStack(ItemHandler.Resource, 1, 0), 0.4F);
|
||||
FurnaceRecipes.smelting().addSmelting(BlockHandler.BlockBase.blockID, 1, new ItemStack(ItemHandler.Resource, 1, 8), 0.4F);
|
||||
FurnaceRecipes.smelting().addSmelting(BlockHandler.BlockBase.blockID, 2, new ItemStack(ItemHandler.Resource, 1, 4), 0.4F);
|
||||
FurnaceRecipes.smelting().addSmelting(BlockHandler.BlockBase.blockID, 4, new ItemStack(ItemHandler.Resource, 1, 5), 0.4F);
|
||||
FurnaceRecipes.smelting().addSmelting(BlockHandler.BlockBase.blockID, 5, new ItemStack(ItemHandler.Resource, 1, 7), 0.4F);
|
||||
FurnaceRecipes.smelting().addSmelting(BlockHandler.BlockBase.blockID, 7, new ItemStack(ItemHandler.Resource, 1, 10), 0.4F);
|
||||
FurnaceRecipes.smelting().addSmelting(BlockHandler.BlockBase.blockID, 11, new ItemStack(ItemHandler.Resource, 1, 6), 0.4F);
|
||||
}
|
||||
|
||||
private static void itemRecipes(){
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package MysticWorld.Items;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Random;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
|
@ -17,6 +18,7 @@ import net.minecraft.entity.item.EntityItem;
|
|||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.FurnaceRecipes;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.EnumMovingObjectType;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
|
|
@ -66,8 +68,6 @@ public class ItemStaffFire extends Item {
|
|||
if (Keyboard.isKeyDown(Keyboard.KEY_RSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
|
||||
{
|
||||
MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, entityPlayer, true);
|
||||
|
||||
Random rand = new Random();
|
||||
|
||||
if (movingobjectposition == null)
|
||||
{
|
||||
|
|
@ -80,7 +80,7 @@ public class ItemStaffFire extends Item {
|
|||
int i = movingobjectposition.blockX;
|
||||
int j = movingobjectposition.blockY;
|
||||
int k = movingobjectposition.blockZ;
|
||||
|
||||
|
||||
if (!world.canMineBlock(entityPlayer, i, j, k))
|
||||
{
|
||||
return itemStack;
|
||||
|
|
@ -92,74 +92,18 @@ public class ItemStaffFire extends Item {
|
|||
}
|
||||
else
|
||||
{
|
||||
if (world.getBlockId(i, j, k) == Block.cobblestone.blockID)
|
||||
{
|
||||
if (!world.isRemote)
|
||||
{
|
||||
world.playSoundEffect((double)i + 0.5D, (double)j + 0.5D, (double)k + 0.5D, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F);
|
||||
world.setBlock(i, j, k, Block.stone.blockID);
|
||||
itemStack.damageItem(1, entityPlayer);
|
||||
}
|
||||
}
|
||||
else if (world.getBlockId(i, j, k) == Block.oreIron.blockID)
|
||||
{
|
||||
if (!world.isRemote)
|
||||
{
|
||||
world.playSoundEffect((double)i + 0.5D, (double)j + 0.5D, (double)k + 0.5D, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F);
|
||||
world.setBlock(i, j, k, 0);
|
||||
world.spawnEntityInWorld(new EntityItem(world, i, j, k, new ItemStack(Item.ingotIron, 1)));
|
||||
itemStack.damageItem(1, entityPlayer);
|
||||
}
|
||||
}
|
||||
else if (world.getBlockId(i, j, k) == Block.oreGold.blockID)
|
||||
{
|
||||
if (!world.isRemote)
|
||||
{
|
||||
world.playSoundEffect((double)i + 0.5D, (double)j + 0.5D, (double)k + 0.5D, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F);
|
||||
world.setBlock(i, j, k, 0);
|
||||
world.spawnEntityInWorld(new EntityItem(world, i, j, k, new ItemStack(Item.ingotGold, 1)));
|
||||
itemStack.damageItem(1, entityPlayer);
|
||||
}
|
||||
}
|
||||
else if (world.getBlockId(i, j, k) == Block.sand.blockID)
|
||||
{
|
||||
if (!world.isRemote)
|
||||
{
|
||||
world.playSoundEffect((double)i + 0.5D, (double)j + 0.5D, (double)k + 0.5D, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F);
|
||||
world.setBlock(i, j, k, Block.glass.blockID);
|
||||
itemStack.damageItem(1, entityPlayer);
|
||||
}
|
||||
}
|
||||
else if (world.getBlockId(i, j, k) == Block.netherrack.blockID)
|
||||
{
|
||||
if (!world.isRemote)
|
||||
{
|
||||
world.playSoundEffect((double)i + 0.5D, (double)j + 0.5D, (double)k + 0.5D, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F);
|
||||
world.setBlock(i, j, k, 0);
|
||||
world.spawnEntityInWorld(new EntityItem(world, i, j, k, new ItemStack(Item.netherrackBrick, 1)));
|
||||
itemStack.damageItem(1, entityPlayer);
|
||||
}
|
||||
}
|
||||
else if (world.getBlockId(i, j, k) == Block.wood.blockID)
|
||||
{
|
||||
if (!world.isRemote)
|
||||
{
|
||||
world.playSoundEffect((double)i + 0.5D, (double)j + 0.5D, (double)k + 0.5D, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F);
|
||||
world.setBlock(i, j, k, 0);
|
||||
world.spawnEntityInWorld(new EntityItem(world, i, j, k, new ItemStack(Item.coal, 1, 1)));
|
||||
itemStack.damageItem(1, entityPlayer);
|
||||
}
|
||||
}
|
||||
else if (world.getBlockId(i, j, k) == Block.cactus.blockID)
|
||||
{
|
||||
if (!world.isRemote)
|
||||
{
|
||||
world.playSoundEffect((double)i + 0.5D, (double)j + 0.5D, (double)k + 0.5D, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F);
|
||||
world.setBlock(i, j, k, 0);
|
||||
world.spawnEntityInWorld(new EntityItem(world, i, j, k, new ItemStack(Item.dyePowder, 1, 2)));
|
||||
itemStack.damageItem(1, entityPlayer);
|
||||
}
|
||||
}
|
||||
ItemStack result = FurnaceRecipes.smelting().getSmeltingResult(new ItemStack(world.getBlockId(i, j, k), 1, world.getBlockMetadata(i, j, k)));
|
||||
|
||||
int id = result.itemID;
|
||||
int meta = result.getItemDamage();
|
||||
|
||||
if (!world.isRemote && !(result == null))
|
||||
{
|
||||
world.playSoundEffect((double)i + 0.5D, (double)j + 0.5D, (double)k + 0.5D, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F);
|
||||
world.setBlock(i, j, k, 0);
|
||||
world.spawnEntityInWorld(new EntityItem(world, i, j, k, new ItemStack(id, 1, meta)));
|
||||
itemStack.damageItem(1, entityPlayer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
package MysticWorld;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.Array;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
|
||||
import MysticWorld.Biome.BiomeHandler;
|
||||
import MysticWorld.Blocks.BlockHandler;
|
||||
|
|
@ -12,13 +14,15 @@ import MysticWorld.WorldGen.*;
|
|||
import net.minecraft.block.Block;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.item.crafting.FurnaceRecipes;
|
||||
import net.minecraft.client.resources.ResourceLocation;
|
||||
import net.minecraft.world.WorldType;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
import net.minecraftforge.common.ChestGenHooks;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import cpw.mods.fml.common.Mod;
|
||||
import cpw.mods.fml.common.Mod.EventHandler;
|
||||
import cpw.mods.fml.common.Mod.Init;
|
||||
import cpw.mods.fml.common.Mod.Instance;
|
||||
import cpw.mods.fml.common.Mod.PostInit;
|
||||
|
|
@ -50,7 +54,9 @@ public class MysticWorld
|
|||
|
||||
public static CreativeTabs MysticWorldTab = new TabMysticWorld(CreativeTabs.getNextID(), "MysticWorldTab");
|
||||
|
||||
@PreInit
|
||||
public static Object[] furnaceInput;
|
||||
|
||||
@EventHandler
|
||||
public void preInit(FMLPreInitializationEvent event)
|
||||
{
|
||||
Config.initialize(new File(event.getModConfigurationDirectory(), "Mystic Mods/Mystic World.cfg"));
|
||||
|
|
@ -59,7 +65,7 @@ public class MysticWorld
|
|||
instance = this;
|
||||
}
|
||||
|
||||
@Init
|
||||
@EventHandler
|
||||
public void load(FMLInitializationEvent event)
|
||||
{
|
||||
proxy.registerRenders();
|
||||
|
|
@ -78,7 +84,7 @@ public class MysticWorld
|
|||
Lang.init();
|
||||
}
|
||||
|
||||
@PostInit
|
||||
@EventHandler
|
||||
public void postInit(FMLPostInitializationEvent event)
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -76,7 +76,6 @@ public class RecipeHandler {
|
|||
}
|
||||
|
||||
private static void itemSmelting(){
|
||||
|
||||
}
|
||||
|
||||
private static void staffRecipe(Item output, ItemStack input){
|
||||
|
|
|
|||
Loading…
Reference in a new issue