A few things
This commit is contained in:
parent
720d2c2aed
commit
78fb37d51a
7 changed files with 88 additions and 15 deletions
|
@ -7,6 +7,9 @@ import net.minecraftforge.event.Cancelable;
|
|||
import net.minecraftforge.event.Event;
|
||||
import universalelectricity.core.vector.Vector3;
|
||||
|
||||
/** Events called when an automated crafter is working on crafting an item
|
||||
*
|
||||
* @author DarkGuardsman */
|
||||
public class AutoCraftEvent extends Event
|
||||
{
|
||||
World world;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package dark.api.events;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
|
@ -8,7 +9,6 @@ import net.minecraft.world.World;
|
|||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.Cancelable;
|
||||
import net.minecraftforge.event.Event;
|
||||
import net.minecraftforge.event.entity.player.PlayerEvent;
|
||||
import universalelectricity.core.vector.Vector3;
|
||||
|
||||
/** An event triggered by entities or tiles that create lasers
|
||||
|
@ -16,9 +16,9 @@ import universalelectricity.core.vector.Vector3;
|
|||
* @author DarkGuardsman */
|
||||
public class LaserEvent extends Event
|
||||
{
|
||||
World world;
|
||||
Vector3 spot;
|
||||
Vector3 target;
|
||||
public World world;
|
||||
public Vector3 spot;
|
||||
public Vector3 target;
|
||||
|
||||
public LaserEvent(World world, Vector3 spot, Vector3 target)
|
||||
{
|
||||
|
@ -31,7 +31,7 @@ public class LaserEvent extends Event
|
|||
@Cancelable
|
||||
public static class LaserFireEvent extends LaserEvent
|
||||
{
|
||||
Object shooter;
|
||||
public Object shooter;
|
||||
|
||||
public LaserFireEvent(World world, Vector3 spot, Vector3 target, Object shooter)
|
||||
{
|
||||
|
@ -44,8 +44,8 @@ public class LaserEvent extends Event
|
|||
@Cancelable
|
||||
public static class LaserFiredPlayerEvent extends LaserFireEvent
|
||||
{
|
||||
ItemStack laserItem;
|
||||
MovingObjectPosition hit;
|
||||
public ItemStack laserItem;
|
||||
public MovingObjectPosition hit;
|
||||
|
||||
public LaserFiredPlayerEvent(EntityPlayer player, MovingObjectPosition hit, ItemStack stack)
|
||||
{
|
||||
|
@ -58,7 +58,7 @@ public class LaserEvent extends Event
|
|||
/** Called when a laser is heating up a block to be mined */
|
||||
public static class LaserMeltBlockEvent extends LaserEvent
|
||||
{
|
||||
Object shooter;
|
||||
public Object shooter;
|
||||
|
||||
public LaserMeltBlockEvent(World world, Vector3 spot, Vector3 hit, Object shooter)
|
||||
{
|
||||
|
@ -67,11 +67,23 @@ public class LaserEvent extends Event
|
|||
}
|
||||
}
|
||||
|
||||
/** Use this to change what drops when the laser finishes mining a block */
|
||||
public static class LaserDropItemEvent extends LaserEvent
|
||||
{
|
||||
public List<ItemStack> items;
|
||||
|
||||
public LaserDropItemEvent(World world, Vector3 spot, Vector3 hit, List<ItemStack> items)
|
||||
{
|
||||
super(world, spot, hit);
|
||||
this.items = items;
|
||||
}
|
||||
}
|
||||
|
||||
/** Called before a laser mines a block */
|
||||
@Cancelable
|
||||
public static class LaserMineBlockEvent extends LaserEvent
|
||||
{
|
||||
Object shooter;
|
||||
public Object shooter;
|
||||
|
||||
public LaserMineBlockEvent(World world, Vector3 spot, Vector3 hit, Object shooter)
|
||||
{
|
||||
|
|
|
@ -101,9 +101,9 @@ public class CoreRecipeLoader extends RecipeLoader
|
|||
// part valve
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(valvePart, new Object[] { "PLP", 'P', "ironPipe", 'L', Block.lever }));
|
||||
//Basic Circuit
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(itemParts, 1, Parts.CircuitBasic.ordinal()), "!#!", "#@#", "!#!", '@', "plateCopper", '#', Block.glass, '!', "copperWire"));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(itemParts, 1, Parts.CircuitBasic.ordinal()), "!#!", "#@#", "!#!", '@', copperPlate, '#', Block.glass, '!', "copperWire"));
|
||||
//Advanced Circuit
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(itemParts, 1, Parts.CircuitAdvanced.ordinal()), "!#!", "#@#", "!#!", '@', "plateCopper", '#', Item.redstone, '!', "copperWire"));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(itemParts, 1, Parts.CircuitAdvanced.ordinal()), "!#!", "#@#", "!#!", '@', copperPlate, '#', Item.redstone, '!', "copperWire"));
|
||||
//Elite Circuit
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(itemParts, 1, Parts.CircuitElite.ordinal()), "!#!", "#@#", "!#!", '@', "plateGold", '#', Item.redstone, '!', "copperWire"));
|
||||
|
||||
|
@ -111,7 +111,12 @@ public class CoreRecipeLoader extends RecipeLoader
|
|||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(itemParts, 1, Parts.Tank.ordinal()), " # ", "# #", " # ", '#', bronze));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(itemParts, 1, Parts.Tank.ordinal()), " # ", "# #", " # ", '#', steel));
|
||||
//Motor
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(itemParts, 1, Parts.Motor.ordinal()), new Object[] { "@!@", "!#!", "@!@", '!', "ingotSteel", '#', Item.ingotIron, '@', "copperWire" }));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(itemParts, 1, Parts.Motor.ordinal()), new Object[] { "@!@", "!#!", "@!@", '!', steel, '#', Item.ingotIron, '@', new ItemStack(itemParts, 8, Parts.COIL.ordinal()) }));
|
||||
//Laser Diode
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(itemParts, 4, Parts.LASER.ordinal()), new Object[] { " G ", "!S!", " C ", '!', "copperWire", 'G', Block.glass, 'S', Block.sand, 'C', RecipeLoader.circuit }));
|
||||
//Coil
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(itemParts, 8, Parts.COIL.ordinal()), new Object[] { "WWW", "W W", "WWW", 'W', "copperWire" }));
|
||||
|
||||
}
|
||||
|
||||
if (itemMetals instanceof ItemOreDirv)
|
||||
|
|
|
@ -176,6 +176,7 @@ public class DarkMain extends ModPrefab
|
|||
}
|
||||
if (CoreRecipeLoader.itemMetals != null)
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.register(CoreRecipeLoader.itemMetals);
|
||||
//Ore material recipe loop
|
||||
for (EnumMaterial mat : EnumMaterial.values())
|
||||
{
|
||||
|
|
|
@ -10,7 +10,8 @@ public enum EnumOrePart
|
|||
GEARS("Gears"),
|
||||
TUBE("Tube"),
|
||||
ROD("Rod"),
|
||||
SCRAPS("Scraps");
|
||||
SCRAPS("Scraps"),
|
||||
MOLTEN_SCRAPS("MoltenScraps");
|
||||
|
||||
public String simpleName;
|
||||
|
||||
|
|
|
@ -2,14 +2,17 @@ package dark.core.common.items;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraftforge.common.Configuration;
|
||||
import net.minecraftforge.event.ForgeSubscribe;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import dark.api.events.LaserEvent;
|
||||
import dark.core.common.DarkMain;
|
||||
import dark.core.interfaces.IExtraInfo.IExtraItemInfo;
|
||||
import dark.core.prefab.ItemBasic;
|
||||
|
@ -109,4 +112,50 @@ public class ItemOreDirv extends ItemBasic implements IExtraItemInfo
|
|||
|
||||
}
|
||||
|
||||
@ForgeSubscribe
|
||||
public void LaserSmeltEvent(LaserEvent.LaserDropItemEvent event)
|
||||
{
|
||||
if (event.items != null)
|
||||
{
|
||||
|
||||
for (int i = 0; i < event.items.size(); i++)
|
||||
{
|
||||
if (event.items.get(i).itemID == Block.blockIron.blockID)
|
||||
{
|
||||
event.items.set(i, EnumMaterial.getStack(EnumMaterial.IRON, EnumOrePart.MOLTEN_SCRAPS, event.items.get(i).stackSize * 9));
|
||||
}
|
||||
else if (event.items.get(i).itemID == Block.blockGold.blockID)
|
||||
{
|
||||
event.items.set(i, EnumMaterial.getStack(EnumMaterial.GOLD, EnumOrePart.MOLTEN_SCRAPS, event.items.get(i).stackSize * 9));
|
||||
}
|
||||
else if (event.items.get(i).itemID == Block.oreIron.blockID)
|
||||
{
|
||||
event.items.set(i, EnumMaterial.getStack(EnumMaterial.IRON, EnumOrePart.MOLTEN_SCRAPS, event.items.get(i).stackSize));
|
||||
}
|
||||
else if (event.items.get(i).itemID == Block.oreGold.blockID)
|
||||
{
|
||||
event.items.set(i, EnumMaterial.getStack(EnumMaterial.GOLD, EnumOrePart.MOLTEN_SCRAPS, event.items.get(i).stackSize));
|
||||
}
|
||||
|
||||
String oreName = OreDictionary.getOreName(OreDictionary.getOreID(event.items.get(i)));
|
||||
|
||||
if (oreName != null)
|
||||
{
|
||||
for (EnumMaterial mat : EnumMaterial.values())
|
||||
{
|
||||
if (oreName.equalsIgnoreCase("ore" + mat.simpleName) || oreName.equalsIgnoreCase(mat.simpleName + "ore"))
|
||||
{
|
||||
event.items.set(i, mat.getStack(EnumOrePart.MOLTEN_SCRAPS, event.items.get(i).stackSize + 1 + event.world.rand.nextInt(3)));
|
||||
break;
|
||||
}
|
||||
else if (oreName.equalsIgnoreCase("ingot" + mat.simpleName) || oreName.equalsIgnoreCase(mat.simpleName + "ingot"))
|
||||
{
|
||||
event.items.set(i, mat.getStack(EnumOrePart.MOLTEN_SCRAPS, event.items.get(i).stackSize));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -91,7 +91,9 @@ public class ItemParts extends ItemBasic implements IExtraItemInfo
|
|||
CircuitAdvanced("circuitAdvanced"),
|
||||
CircuitElite("circuitElite"),
|
||||
Motor("motor"),
|
||||
IC("IC_Chip");
|
||||
IC("IC_Chip"),
|
||||
COIL("Coil"),
|
||||
LASER("LaserDiode");
|
||||
|
||||
public String name;
|
||||
public Icon icon;
|
||||
|
|
Loading…
Reference in a new issue