summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2014-10-19 19:10:11 +0100
committerDaniel Silverstone <dsilvers@digital-scurf.org>2014-10-19 19:10:11 +0100
commit4c9ce832cf8b39483060a3464d0935174816a731 (patch)
tree18e663917d19636460c6851776b3676f3c33a18e
parentcb51f55c6e1e06bca96c38fb57d99b8715de43ba (diff)
downloadnoctis-4c9ce832cf8b39483060a3464d0935174816a731.tar.bz2
Add support for recipes and make the glass sword glow like it's enchanted
-rw-r--r--src/main/java/net/flarn/noctis/Noctis.java2
-rw-r--r--src/main/java/net/flarn/noctis/init/Recipes.java25
-rw-r--r--src/main/java/net/flarn/noctis/item/ItemGlassSword.java12
3 files changed, 39 insertions, 0 deletions
diff --git a/src/main/java/net/flarn/noctis/Noctis.java b/src/main/java/net/flarn/noctis/Noctis.java
index 21e5592..19a73f7 100644
--- a/src/main/java/net/flarn/noctis/Noctis.java
+++ b/src/main/java/net/flarn/noctis/Noctis.java
@@ -8,6 +8,7 @@ import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import net.flarn.noctis.handler.ConfigHandler;
import net.flarn.noctis.init.ModItems;
+import net.flarn.noctis.init.Recipes;
import net.flarn.noctis.proxy.IProxy;
import net.flarn.noctis.refs.Refs;
@@ -31,6 +32,7 @@ public class Noctis {
@Mod.EventHandler
public void init(FMLInitializationEvent envent) {
// Guis, TileEntity, recipes, etc. (general event handlers)
+ Recipes.init();
}
@Mod.EventHandler
diff --git a/src/main/java/net/flarn/noctis/init/Recipes.java b/src/main/java/net/flarn/noctis/init/Recipes.java
new file mode 100644
index 0000000..3a48102
--- /dev/null
+++ b/src/main/java/net/flarn/noctis/init/Recipes.java
@@ -0,0 +1,25 @@
+package net.flarn.noctis.init;
+
+import cpw.mods.fml.common.registry.GameRegistry;
+import net.flarn.noctis.handler.ConfigHandler;
+import net.minecraft.init.Items;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.item.crafting.IRecipe;
+import net.minecraftforge.oredict.ShapedOreRecipe;
+
+/**
+ * Created by dsilvers on 19/10/14.
+ */
+public class Recipes {
+
+ public static void init() {
+ IRecipe glassSwordRecipe;
+ if (ConfigHandler.cheapRecipes) {
+ glassSwordRecipe = new ShapedOreRecipe(new ItemStack(ModItems.glassSword), " g ", " g ", " s ", 'g', "blockGlassColorless", 's', "stickWood");
+ } else {
+ glassSwordRecipe = new ShapedOreRecipe(new ItemStack(ModItems.glassSword), " g ", " g ", " s ", 'g', "blockGlassColorless", 's', new ItemStack(Items.diamond_sword));
+ }
+ GameRegistry.addRecipe(glassSwordRecipe);
+ }
+}
diff --git a/src/main/java/net/flarn/noctis/item/ItemGlassSword.java b/src/main/java/net/flarn/noctis/item/ItemGlassSword.java
index 5fea020..6d7c0b5 100644
--- a/src/main/java/net/flarn/noctis/item/ItemGlassSword.java
+++ b/src/main/java/net/flarn/noctis/item/ItemGlassSword.java
@@ -1,5 +1,12 @@
package net.flarn.noctis.item;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import net.flarn.noctis.utils.LogHelper;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.world.World;
+
public class ItemGlassSword extends ItemNoctisBase {
public ItemGlassSword() {
@@ -7,4 +14,9 @@ public class ItemGlassSword extends ItemNoctisBase {
this.setUnlocalizedName("glassSword");
}
+ @Override
+ @SideOnly(Side.CLIENT)
+ public boolean hasEffect(ItemStack par1ItemStack, int pass) {
+ return true;
+ }
}