summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2014-10-19 17:49:11 +0100
committerDaniel Silverstone <dsilvers@digital-scurf.org>2014-10-19 17:49:11 +0100
commit5ff454d758d951571bc6cb40dca26226fd878671 (patch)
tree553dd66c76459248363438385a1ef13c78ef4e12
parent6f0d61677fd3142988dac892c55f3dcf7064511a (diff)
downloadnoctis-5ff454d758d951571bc6cb40dca26226fd878671.tar.bz2
In theory, an item, but the texture and localisation seem off
-rw-r--r--src/main/java/net/flarn/noctis/Noctis.java2
-rw-r--r--src/main/java/net/flarn/noctis/init/ModItems.java14
-rw-r--r--src/main/java/net/flarn/noctis/item/ItemGlassSword.java12
-rw-r--r--src/main/java/net/flarn/noctis/item/ItemNoctisBase.java38
-rw-r--r--src/main/java/net/flarn/noctis/refs/Textures.java5
-rw-r--r--src/main/resources/assets/noctis/lang/en.lang2
-rw-r--r--src/main/resources/assets/noctis/textures/items/glassSword.pngbin0 -> 286 bytes
-rw-r--r--src/main/resources/mcmod.info2
8 files changed, 74 insertions, 1 deletions
diff --git a/src/main/java/net/flarn/noctis/Noctis.java b/src/main/java/net/flarn/noctis/Noctis.java
index 7c10203..21e5592 100644
--- a/src/main/java/net/flarn/noctis/Noctis.java
+++ b/src/main/java/net/flarn/noctis/Noctis.java
@@ -7,6 +7,7 @@ import cpw.mods.fml.common.event.FMLInitializationEvent;
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.proxy.IProxy;
import net.flarn.noctis.refs.Refs;
@@ -24,6 +25,7 @@ public class Noctis {
// Network, mod config, items, blocks
ConfigHandler.init(event.getSuggestedConfigurationFile());
FMLCommonHandler.instance().bus().register(new ConfigHandler());
+ ModItems.init();
}
@Mod.EventHandler
diff --git a/src/main/java/net/flarn/noctis/init/ModItems.java b/src/main/java/net/flarn/noctis/init/ModItems.java
new file mode 100644
index 0000000..921dcc2
--- /dev/null
+++ b/src/main/java/net/flarn/noctis/init/ModItems.java
@@ -0,0 +1,14 @@
+package net.flarn.noctis.init;
+
+
+import cpw.mods.fml.common.registry.GameRegistry;
+import net.flarn.noctis.item.ItemGlassSword;
+import net.flarn.noctis.item.ItemNoctisBase;
+
+public class ModItems {
+ public static final ItemNoctisBase glassSword = new ItemGlassSword();
+
+ public static void init() {
+ GameRegistry.registerItem(glassSword, "glassSword");
+ }
+}
diff --git a/src/main/java/net/flarn/noctis/item/ItemGlassSword.java b/src/main/java/net/flarn/noctis/item/ItemGlassSword.java
new file mode 100644
index 0000000..c4895aa
--- /dev/null
+++ b/src/main/java/net/flarn/noctis/item/ItemGlassSword.java
@@ -0,0 +1,12 @@
+package net.flarn.noctis.item;
+
+import net.minecraft.item.Item;
+
+public class ItemGlassSword extends ItemNoctisBase {
+
+ public ItemGlassSword() {
+ super();
+ this.setUnlocalizedName("glassSword");
+ }
+
+}
diff --git a/src/main/java/net/flarn/noctis/item/ItemNoctisBase.java b/src/main/java/net/flarn/noctis/item/ItemNoctisBase.java
new file mode 100644
index 0000000..5e32d4e
--- /dev/null
+++ b/src/main/java/net/flarn/noctis/item/ItemNoctisBase.java
@@ -0,0 +1,38 @@
+package net.flarn.noctis.item;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import net.flarn.noctis.refs.Textures;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+
+public class ItemNoctisBase extends Item {
+ public ItemNoctisBase() {
+ super();
+ this.maxStackSize = 1;
+ this.setNoRepair();
+ }
+
+ @Override
+ public String getUnlocalizedName() {
+ return String.format("item.%s%s", Textures.RESOURCE_PREFIX, getUnwrappedUnlocalizedName(super.getUnlocalizedName()));
+ }
+
+ @Override
+ public String getUnlocalizedName(ItemStack itemStack) {
+ return String.format("item.%s%s", Textures.RESOURCE_PREFIX, getUnwrappedUnlocalizedName(super.getUnlocalizedName()));
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void registerIcons(IIconRegister iconRegister) {
+ iconRegister.registerIcon(this.getUnlocalizedName().substring(this.getUnlocalizedName().indexOf(".") + 1));
+ }
+
+ protected String getUnwrappedUnlocalizedName(String unLocalizedName) {
+ return unLocalizedName.substring(unLocalizedName.indexOf(".") + 1);
+ }
+
+
+}
diff --git a/src/main/java/net/flarn/noctis/refs/Textures.java b/src/main/java/net/flarn/noctis/refs/Textures.java
new file mode 100644
index 0000000..1eeb747
--- /dev/null
+++ b/src/main/java/net/flarn/noctis/refs/Textures.java
@@ -0,0 +1,5 @@
+package net.flarn.noctis.refs;
+
+public class Textures {
+ public static final String RESOURCE_PREFIX = Refs.MOD_ID.toLowerCase() + ":";
+}
diff --git a/src/main/resources/assets/noctis/lang/en.lang b/src/main/resources/assets/noctis/lang/en.lang
new file mode 100644
index 0000000..58833a6
--- /dev/null
+++ b/src/main/resources/assets/noctis/lang/en.lang
@@ -0,0 +1,2 @@
+# Item localisations
+item.noctis:glassSword.name=Unattuned Glass Sword
diff --git a/src/main/resources/assets/noctis/textures/items/glassSword.png b/src/main/resources/assets/noctis/textures/items/glassSword.png
new file mode 100644
index 0000000..fa84d39
--- /dev/null
+++ b/src/main/resources/assets/noctis/textures/items/glassSword.png
Binary files differ
diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info
index a7c671d..50988dd 100644
--- a/src/main/resources/mcmod.info
+++ b/src/main/resources/mcmod.info
@@ -4,7 +4,7 @@
"name": "Noctis - Spatio Inter Stellarum",
"description": "There's energy in that that starspace",
"version": "1.7.10-0.0.1",
- "noversion": "",
+ "mcversion": "1.7.10",
"url": "",
"updateUrl": "",
"authorList": [