Fixed resource item coloring

This commit is contained in:
Calclavia 2014-12-27 16:22:17 +08:00
parent e16246e6b1
commit 0a9d565cf2
5 changed files with 13 additions and 9 deletions

View file

@ -102,13 +102,13 @@ object ResourceFactory
mixtureBucketMap += materialName -> mixtureBucket
//Generate rubble, dust and refined dust
val rubble = new ItemStack(CoreContent.manager.newItem("rubble" + materialName.capitalizeFirst, new ItemRubble))
val rubble = new ItemStack(CoreContent.manager.newItem("rubble" + materialName.capitalizeFirst, new ItemRubble(materialName)))
LanguageRegistry.instance.addStringLocalization(rubble.getUnlocalizedName + ".name", localizedName + " " + "tooltip.rubble".getLocal)
val dust = new ItemStack(CoreContent.manager.newItem("dust" + materialName.capitalizeFirst, new ItemDust))
val dust = new ItemStack(CoreContent.manager.newItem("dust" + materialName.capitalizeFirst, new ItemDust(materialName)))
LanguageRegistry.instance.addStringLocalization(dust.getUnlocalizedName + ".name", localizedName + " " + "tooltip.dust".getLocal)
val refinedDust = new ItemStack(CoreContent.manager.newItem("refinedDust" + materialName.capitalizeFirst, new ItemRefinedDust))
val refinedDust = new ItemStack(CoreContent.manager.newItem("refinedDust" + materialName.capitalizeFirst, new ItemRefinedDust(materialName)))
LanguageRegistry.instance.addStringLocalization(refinedDust.getUnlocalizedName + ".name", localizedName + " " + "tooltip.refinedDust".getLocal)
//Register rubble, dust and refined dust to OreDictionary

View file

@ -5,7 +5,7 @@ import resonantinduction.core.Reference
/**
* @author Calclavia
*/
class ItemDust extends ItemResource
class ItemDust(material : String) extends ItemResource(material)
{
setTextureName(Reference.prefix + "oreDust")
}

View file

@ -5,7 +5,7 @@ import resonantinduction.core.Reference
/**
* @author Calclavia
*/
class ItemRefinedDust extends ItemResource
class ItemRefinedDust(material : String) extends ItemResource(material)
{
setTextureName(Reference.prefix + "oreRefinedDust")

View file

@ -1,12 +1,16 @@
package resonantinduction.core.resource.content
import net.minecraft.item.Item
import net.minecraft.item.{Item, ItemStack}
import resonantinduction.core.resource.ResourceFactory
/**
* A class used by rubble, dusts and refined dusts
* @author Calclavia
*/
abstract class ItemResource extends Item
abstract class ItemResource(material : String) extends Item
{
override def getColorFromItemStack(p_82790_1_ : ItemStack, p_82790_2_ : Int): Int =
{
return ResourceFactory.getColor(material)
}
}

View file

@ -5,7 +5,7 @@ import resonantinduction.core.Reference
/**
* @author Calclavia
*/
class ItemRubble extends ItemResource
class ItemRubble(material : String) extends ItemResource(material)
{
setTextureName(Reference.prefix + "oreRubble")
}