ItemBlock now implements ITextureProvider so that blocks with custom textures will showup properly when being held.

This commit is contained in:
LexManos 2012-03-06 00:28:12 -08:00
parent f847e37119
commit 885484f75f
1 changed files with 30 additions and 0 deletions

View File

@ -0,0 +1,30 @@
--- ../src_base/minecraft/net/minecraft/src/ItemBlock.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/ItemBlock.java 0000-00-00 00:00:00.000000000 -0000
@@ -1,6 +1,8 @@
package net.minecraft.src;
-public class ItemBlock extends Item
+import net.minecraft.src.forge.ITextureProvider;
+
+public class ItemBlock extends Item implements ITextureProvider
{
/** The block ID of the Block associated with this ItemBlock */
private int blockID;
@@ -110,4 +112,17 @@
{
return Block.blocksList[this.blockID].getBlockName();
}
+
+ @Override
+ public String getTextureFile()
+ {
+ if (Block.blocksList[blockID] instanceof ITextureProvider)
+ {
+ return ((ITextureProvider)Block.blocksList[blockID]).getTextureFile();
+ }
+ else
+ {
+ return "/terrain.png";
+ }
+ }
}