From da96375b8c8194856ec58cfea2e0e4e56a676a8a Mon Sep 17 00:00:00 2001 From: DarkGuardsman Date: Sat, 2 Nov 2013 08:10:51 -0400 Subject: [PATCH] Recipe Stuff --- .../assets/dark/textures/items/IC_CHIP.png | Bin 0 -> 2243 bytes .../items/{SlimeSeal.png => gasSeal.png} | Bin src/dark/core/client/Effects.java | 41 ++++++++++++++++++ src/dark/core/common/CoreRecipeLoader.java | 17 ++++++-- src/dark/core/common/DarkMain.java | 10 ++++- src/dark/core/common/items/ItemParts.java | 15 ++++--- src/dark/core/prefab/ModPrefab.java | 4 +- .../core/prefab/machine/BlockMachine.java | 20 ++++++++- .../tilenetwork/NetworkTileEntities.java | 18 ++++---- 9 files changed, 104 insertions(+), 21 deletions(-) create mode 100644 resources/assets/dark/textures/items/IC_CHIP.png rename resources/assets/dark/textures/items/{SlimeSeal.png => gasSeal.png} (100%) create mode 100644 src/dark/core/client/Effects.java diff --git a/resources/assets/dark/textures/items/IC_CHIP.png b/resources/assets/dark/textures/items/IC_CHIP.png new file mode 100644 index 0000000000000000000000000000000000000000..93f5b13a0af2fa9df690bd9cc0fea326b0ea88a6 GIT binary patch literal 2243 zcmV;!2t4Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2i*$- z2p|K!Gk9wN00=`#L_t(o!=0DwZyaY8#((F1-IG;% z6p1#G2q2nLXhQ)N1pf^ZNbrGAl`3ddp;l=wcBpzuTU4o`P#_oEN#i)a)$w}Q-nqPo z53{>*5~VbZG}7$s%zMuBJm;ME8BtZ`4iE1=s*0#beah7NbDSDK!J88&snz=U-qX+U z&?Ao_#v;}sBDY=2eQqQLm5o2zSE?j&%qJgz#KiG8`0MydCeNQme2Nj};?xBWJ@*3p zzw=!JV^KhaY_Xeik=rrQxvMA&c=Z@n;?_DJzW*L4-#E&f;}gtYnE_SQd%%Mxh;@`I zy?pM#KOH;f5sqZ4>aC1s4>2%F4Xr0uj-NnTiP{R#^`K(5=dy1-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6yLWKPI?f*@dhtx0eHAj2bD5wTz(2y=+Bv|6pMs}>P*xg5rr ztnans7afI4jUY*Ja+?I?1|lSLJt72QfVGxfK94mfdr%?F5JT6sSx2F#-0rel<-RisL_mcwUto2$fqF%(;8hW0DOY<*(=_u5+CgbQ zx6U2^#}S6P?gz|9I;+*{t;Y3#94`B!{6Y$JFY@^uxiG~0^oC$xH0Z{%`Y*=K=GC;r Rbm0I1002ovPDHLkV1i2JEARjS literal 0 HcmV?d00001 diff --git a/resources/assets/dark/textures/items/SlimeSeal.png b/resources/assets/dark/textures/items/gasSeal.png similarity index 100% rename from resources/assets/dark/textures/items/SlimeSeal.png rename to resources/assets/dark/textures/items/gasSeal.png diff --git a/src/dark/core/client/Effects.java b/src/dark/core/client/Effects.java new file mode 100644 index 00000000..f95b065b --- /dev/null +++ b/src/dark/core/client/Effects.java @@ -0,0 +1,41 @@ +package dark.core.client; + +import net.minecraft.entity.Entity; +import net.minecraft.util.Vec3; +import net.minecraft.world.World; +import universalelectricity.core.vector.Vector3; + +public class Effects +{ + public static void drawParticleStreamTo(World world, Vector3 start, Vector3 end) + { + + } + + public static void drawParticleStreamTo(Entity shooter, World world, double x, double y, double z) + { + Vec3 direction = shooter.getLookVec().normalize(); + double scale = 1.0; + double xoffset = 1.3f; + double yoffset = -.2; + double zoffset = 0.3f; + Vec3 horzdir = direction.normalize(); + horzdir.yCoord = 0; + horzdir = horzdir.normalize(); + double cx = shooter.posX + direction.xCoord * xoffset - direction.yCoord * horzdir.xCoord * yoffset - horzdir.zCoord * zoffset; + double cy = shooter.posY + shooter.getEyeHeight() + direction.yCoord * xoffset + (1 - Math.abs(direction.yCoord)) * yoffset; + double cz = shooter.posZ + direction.zCoord * xoffset - direction.yCoord * horzdir.zCoord * yoffset + horzdir.xCoord * zoffset; + double dx = x - cx; + double dy = y - cy; + double dz = z - cz; + double ratio = Math.sqrt(dx * dx + dy * dy + dz * dz); + + while (Math.abs(cx - x) > Math.abs(dx / ratio)) + { + world.spawnParticle("townaura", cx, cy, cz, 0.0D, 0.0D, 0.0D); + cx += dx * 0.1 / ratio; + cy += dy * 0.1 / ratio; + cz += dz * 0.1 / ratio; + } + } +} diff --git a/src/dark/core/common/CoreRecipeLoader.java b/src/dark/core/common/CoreRecipeLoader.java index 56dddad3..173fdcd5 100644 --- a/src/dark/core/common/CoreRecipeLoader.java +++ b/src/dark/core/common/CoreRecipeLoader.java @@ -44,7 +44,7 @@ public class CoreRecipeLoader extends RecipeLoader public static ItemStack unfinishedTank; public static Item itemGlowingSand; public static Item itemDiggingTool; - public static boolean debugOreItems = true; + public static boolean debugOreItems = false; @Override public void loadRecipes() @@ -94,12 +94,21 @@ public class CoreRecipeLoader extends RecipeLoader // seal GameRegistry.addRecipe(this.setStackSize(leatherSeal, 16), new Object[] { "LL", "LL", 'L', Item.leather }); // slime steal - new RecipeGrid(this.setStackSize(slimeSeal, 4)).setRowOne(null, leatherSeal, null).setRowTwo(leatherSeal, Item.slimeBall, leatherSeal).setRowThree(null, leatherSeal, null).RegisterRecipe(); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(itemParts, 4, Parts.GasSeal.ordinal()), " # ", "#S#", " # ", '#', "leatherSeal", 'S', Item.slimeBall)); // 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")); + //Advanced Circuit + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(itemParts, 1, Parts.CircuitAdvanced.ordinal()), "!#!", "#@#", "!#!", '@', "plateCopper", '#', Item.redstone, '!', "copperWire")); + //Elite Circuit + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(itemParts, 1, Parts.CircuitElite.ordinal()), "!#!", "#@#", "!#!", '@', "plateGold", '#', Item.redstone, '!', "copperWire")); + // unfinished tank - new RecipeGrid(unfinishedTank).setRowOne(null, Item.ingotIron, null).setRowTwo(Item.ingotIron, null, Item.ingotIron).setRowThree(null, Item.ingotIron, null).RegisterRecipe(); - new RecipeGrid(unfinishedTank).setRowOne(null, bronze, null).setRowTwo(bronze, null, bronze).setRowThree(null, bronze, null).RegisterRecipe(); + 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" })); } if (itemMetals instanceof ItemOreDirv) diff --git a/src/dark/core/common/DarkMain.java b/src/dark/core/common/DarkMain.java index 727cd576..c0f15fac 100644 --- a/src/dark/core/common/DarkMain.java +++ b/src/dark/core/common/DarkMain.java @@ -53,6 +53,7 @@ import dark.core.common.items.ItemOreDirv; import dark.core.common.items.ItemParts; import dark.core.common.items.ItemReadoutTools; import dark.core.common.items.ItemWrench; +import dark.core.common.items.ItemParts.Parts; import dark.core.common.machines.BlockBasicMachine; import dark.core.common.machines.BlockSolarPanel; import dark.core.common.transmit.BlockWire; @@ -142,7 +143,14 @@ public class DarkMain extends ModPrefab } } } - if (CoreRecipeLoader.itemMetals instanceof ItemOreDirv) + if (CoreRecipeLoader.itemParts instanceof ItemParts) + { + for (Parts part : Parts.values()) + { + OreDictionary.registerOre(part.name, new ItemStack(CoreRecipeLoader.itemParts, 1, part.ordinal())); + } + } + if (CoreRecipeLoader.itemMetals != null) { //Ore material recipe loop for (EnumMaterial mat : EnumMaterial.values()) diff --git a/src/dark/core/common/items/ItemParts.java b/src/dark/core/common/items/ItemParts.java index efcdfdb1..b4f79e3a 100644 --- a/src/dark/core/common/items/ItemParts.java +++ b/src/dark/core/common/items/ItemParts.java @@ -83,11 +83,16 @@ public class ItemParts extends ItemBasic implements IExtraItemInfo public static enum Parts { - Seal("LeatherSeal"), - GasSeal("GasSeal"), - Tank("UnfinishedTank"), - Valve("ValvePart"), - MiningIcon("miningIcon", false); + Seal("leatherSeal"), + GasSeal("gasSeal"), + Tank("unfinishedTank"), + Valve("valvePart"), + MiningIcon("miningIcon", false), + CircuitBasic("circuitBasic"), + CircuitAdvanced("circuitAdvanced"), + CircuitElite("circuitElite"), + Motor("motor"), + IC("IC_Chip"); public String name; public Icon icon; diff --git a/src/dark/core/prefab/ModPrefab.java b/src/dark/core/prefab/ModPrefab.java index 3bf579d9..c17578e2 100644 --- a/src/dark/core/prefab/ModPrefab.java +++ b/src/dark/core/prefab/ModPrefab.java @@ -65,7 +65,7 @@ public abstract class ModPrefab * has been made */ public static int getNextItemId() { - int id = BLOCK_ID_PRE; + int id = ITEM_ID_PREFIX; while (id > 255 && id < (Item.itemsList.length - 1)) { @@ -76,7 +76,7 @@ public abstract class ModPrefab } id++; } - BLOCK_ID_PRE = id + 1; + ITEM_ID_PREFIX = id + 1; return id; } diff --git a/src/dark/core/prefab/machine/BlockMachine.java b/src/dark/core/prefab/machine/BlockMachine.java index b2f53fa2..b41cbaa1 100644 --- a/src/dark/core/prefab/machine/BlockMachine.java +++ b/src/dark/core/prefab/machine/BlockMachine.java @@ -28,7 +28,7 @@ import dark.core.registration.ModObjectRegistry.BlockBuildData; /** Basic TileEntity Container class designed to be used by generic machines. It is suggested that * each mod using this create there own basic block extending this to reduce need to use build data * per block. - * + * * @author Darkguardsman */ public abstract class BlockMachine extends BlockTile implements IExtraBlockInfo { @@ -104,6 +104,24 @@ public abstract class BlockMachine extends BlockTile implements IExtraBlockInfo } } + @Override + public void onNeighborTileChange(World world, int x, int y, int z, int tileX, int tileY, int tileZ) + { + super.onNeighborTileChange(world, x, y, z, tileX, tileY, tileZ); + TileEntity tileEntity = world.getBlockTileEntity(x, y, z); + + if (tileEntity instanceof INetworkPart) + { + ((INetworkPart) tileEntity).refresh(); + } + } + + public void breakBlock(World world, int x, int y, int z, int par5, int par6) + { + super.breakBlock(world, x, y, z, par5, par6); + world.notifyBlockChange(x, y, z, world.getBlockId(x, y, z)); + } + @Override public TileEntity createTileEntity(World world, int metadata) { diff --git a/src/dark/core/prefab/tilenetwork/NetworkTileEntities.java b/src/dark/core/prefab/tilenetwork/NetworkTileEntities.java index 68d3f75a..17b8364b 100644 --- a/src/dark/core/prefab/tilenetwork/NetworkTileEntities.java +++ b/src/dark/core/prefab/tilenetwork/NetworkTileEntities.java @@ -32,13 +32,13 @@ public abstract class NetworkTileEntities /** Creates a new instance of this network to be used to merge or split networks while still * maintaining each class that extends the base network class - * + * * @return - new network instance using the current networks properties */ public abstract NetworkTileEntities newInstance(); /** Adds a TileEntity to the network. extends this to catch non-network parts and add them to * other tile lists - * + * * @param tileEntity - tileEntity instance * @param member - add to network member list * @return */ @@ -127,7 +127,7 @@ public abstract class NetworkTileEntities /** Combines two networks together into one. Calls to preMerge and doMerge instead of doing the * merge process itself - * + * * @param network * @param mergePoint */ public void merge(NetworkTileEntities network, INetworkPart mergePoint) @@ -143,17 +143,17 @@ public abstract class NetworkTileEntities /** Processing that needs too be done before the network merges. Use this to do final network * merge calculations and to cause network merge failure - * + * * @param network the network that is to merge with this one * @param part the part at which started the network merge. Use this to cause damage if two * networks merge with real world style failures - * + * * @return false if the merge needs to be canceled. - * + * * Cases in which the network should fail to merge are were the two networks merge with error. * Or, in the case of pipes the two networks merge and the merge point was destroyed by * combination of liquids. - * + * * Ex Lava and water */ public boolean preMergeProcessing(NetworkTileEntities network, INetworkPart part) { @@ -235,6 +235,8 @@ public abstract class NetworkTileEntities } } } + this.cleanUpMembers(); + } } @@ -245,7 +247,7 @@ public abstract class NetworkTileEntities } /** invalidates/remove a tile from the networks that surround and connect to it - * + * * @param tileEntity - tile */ public static void invalidate(TileEntity tileEntity) {