Jump to content

Recommended Posts

Posted

Hello,

 

I am a fairly new modder, working on my second mod called RGB Gems. It adds three different kinds of ore to the game, Rubite, Sapphirite and Emerite. When in my dev environment everything works just fine like it should but when I compile my mod and add it to a Minecraft Profile the Rubite Ore texture overwrites the stone one. Everything functions correctly but it looks horrible. I'd be happy to provide any code that would be helpful in finding the problem but at the moment I have no idea what could be the cause.

 

Any help is appreciated, thank you!

 

Laterz,

~Jake

 

EDIT:

 

Okay, here's the code from my OreRubite Class:

package jakegems;

import java.util.Random;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;

public class OreRubite extends Block {

public OreRubite(int id, Material material) {
	super (id, material);
	setHardness(1.5f);
	setStepSound(Block.soundStoneFootstep);
	setTextureName("jakegems:oreRubite");
}

public int idDropped (int metadata, Random random, int fortune) {

	return JakeGems.gemRubite.itemID;

}

public int quantityDroppedWithBonus(int par1, Random par2random) {

	return this.quantityDropped(par2random)+par2random.nextInt(par1+1);

}

public void dropBlockAsItemWithChance (World world, int par2, int par3, int par4, int par5, float par6, int par7) {

	super.dropBlockAsItemWithChance(world, par2, par3, par4, par5, par6, par7);

	if (this.idDropped(par5, world.rand, par7) != this.blockID) {

		int xporbs = 0;
		xporbs = MathHelper.getRandomIntegerInRange(world.rand, 0, 12);

		this.dropXpOnBlockBreak(world, par2, par3, par4, xporbs);
	}

}
}

 

And from my Mod Class:

package jakegems;

import java.io.File;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.EnumToolMaterial;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraftforge.common.Configuration;
import net.minecraftforge.common.EnumHelper;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.oredict.OreDictionary;
import net.minecraftforge.oredict.ShapedOreRecipe;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;

@Mod(modid = "jakegems", name = "Jake's Gems Mod", version = "1.0")
@NetworkMod(clientSideRequired = true, serverSideRequired = false)

public class JakeGems {

@Instance(value = "jakegems")
public static JakeGems instance;

static EnumToolMaterial toolGem = EnumHelper.addToolMaterial("LowPower", 2, 512, 8.0F, 3, 16);

public static int gemRubiteID;
public static int gemSapphiriteID;
public static int gemEmeriteID;

public static int rubitePickaxeID;
public static int rubiteShovelID;
public static int rubiteAxeID;
public static int rubiteSwordID;
public static int rubiteHoeID;

public static int sapphiritePickaxeID;
public static int sapphiriteShovelID;
public static int sapphiriteAxeID;
public static int sapphiriteSwordID;
public static int sapphiriteHoeID;

public static int emeritePickaxeID;
public static int emeriteShovelID;
public static int emeriteAxeID;
public static int emeriteSwordID;
public static int emeriteHoeID;

public static int blockRubiteID;
public static int blockSapphiriteID;
public static int blockEmeriteID;

public static int oreRubiteID;
public static int oreSapphiriteID;
public static int oreEmeriteID;

public static Item gemRubite;
public static Item gemSapphirite;
public static Item gemEmerite;

public static Item rubitePickaxe;
public static Item rubiteShovel;
public static Item rubiteAxe;
public static Item rubiteSword;
public static Item rubiteHoe;

public static Item sapphiritePickaxe;
public static Item sapphiriteShovel;
public static Item sapphiriteAxe;
public static Item sapphiriteSword;
public static Item sapphiriteHoe;

public static Item emeritePickaxe;
public static Item emeriteShovel;
public static Item emeriteAxe;
public static Item emeriteSword;
public static Item emeriteHoe;

public static Block blockRubite;
public static Block blockSapphirite;
public static Block blockEmerite;

public static Block oreRubite;
public static Block oreSapphirite;
public static Block oreEmerite;

@SidedProxy(clientSide = "jakegems.client.ClientProxy", serverSide = "jakegems.CommonProxy")
public static CommonProxy proxy;

public static CreativeTabs tabGems = new CreativeTabs("tabGems") {

	public ItemStack getIconItemStack() {

		return new ItemStack(gemRubite, 1, 0);

	}

};

public static CreativeTabs tabGemTools = new CreativeTabs("tabGemTools") {

	public ItemStack getIconItemStack() {
		return new ItemStack(rubitePickaxe, 1, 0);
	}

};

public void initConfig(FMLPreInitializationEvent event) {

	Configuration config = new Configuration(new File("config/Jake's Gems.cfg"));
	config.load();

	gemRubiteID = config.getItem("rubite", 8212).getInt();
	gemSapphiriteID = config.getItem("sapphirite", 8213).getInt();
	gemEmeriteID = config.getItem("emerite", 8214).getInt();

	rubitePickaxeID = config.getItem("rubitePickaxe", 8215).getInt();
	rubiteShovelID = config.getItem("rubiteShovel", 8216).getInt();
	rubiteAxeID = config.getItem("rubiteAxe", 8217).getInt();
	rubiteSwordID = config.getItem("rubiteSword", 8218).getInt();
	rubiteHoeID = config.getItem("rubiteHoe", 8219).getInt();

	sapphiritePickaxeID = config.getItem("sapphiritePickaxe", 8220).getInt();
	sapphiriteShovelID = config.getItem("sapphiriteShovel", 8221).getInt();
	sapphiriteAxeID = config.getItem("sapphiriteAxe", 8222).getInt();
	sapphiriteSwordID = config.getItem("sapphiriteSword", 8223).getInt();
	sapphiriteHoeID = config.getItem("sapphiriteHoe", 8224).getInt();

	emeritePickaxeID = config.getItem("emeritePickaxe", 8225).getInt();
	emeriteShovelID = config.getItem("emeriteShovel", 8226).getInt();
	emeriteAxeID = config.getItem("emeriteAxe", 8227).getInt();
	emeriteSwordID = config.getItem("emeriteSword", 8228).getInt();
	emeriteHoeID = config.getItem("emeriteHoe", 8229).getInt();

	blockRubiteID = config.getBlock("blockRubite", 2528).getInt();
	blockSapphiriteID = config.getBlock("blockSapphirite", 2529).getInt();
	blockEmeriteID = config.getBlock("blockEmerite", 2530).getInt();

	oreRubiteID = config.getBlock("oreRubite", 2531).getInt();
	oreSapphiriteID = config.getBlock("oreSapphirite", 2532).getInt();
	oreEmeriteID = config.getBlock("oreEmerite", 2533).getInt();

	config.save();

}

private void addItems() {

	//Items
	gemRubite = new BasicItem(this.gemRubiteID)
	.setUnlocalizedName("gemRubite")
	.setTextureName("jakegems:gemRubite")
	.setCreativeTab(this.tabGems);

	gemSapphirite = new BasicItem(this.gemSapphiriteID)
	.setUnlocalizedName("gemSapphirite")
	.setTextureName("jakegems:gemSapphirite")
	.setCreativeTab(this.tabGems);

	gemEmerite = new BasicItem(this.gemEmeriteID)
	.setUnlocalizedName("gemEmerite")
	.setTextureName("jakegems:gemEmerite")
	.setCreativeTab(this.tabGems);

	//Tools

	//Rubite
	rubitePickaxe = new BasicPickaxe(this.rubitePickaxeID, toolGem)
	.setUnlocalizedName("rubitePickaxe")
	.setTextureName("jakegems:rubitePickaxe")
	.setCreativeTab(this.tabGemTools);

	rubiteShovel = new BasicShovel(this.rubiteShovelID, toolGem)
	.setUnlocalizedName("rubiteShovel")
	.setTextureName("jakegems:rubiteShovel")
	.setCreativeTab(this.tabGemTools);

	rubiteAxe = new BasicAxe(this.rubiteAxeID, toolGem)
	.setUnlocalizedName("rubiteAxe")
	.setTextureName("jakegems:rubiteAxe")
	.setCreativeTab(this.tabGemTools);

	rubiteSword = new BasicSword(this.rubiteSwordID, toolGem)
	.setUnlocalizedName("rubiteSword")
	.setTextureName("jakegems:rubiteSword")
	.setCreativeTab(this.tabGemTools);

	rubiteHoe = new BasicHoe(this.rubiteHoeID, toolGem)
	.setUnlocalizedName("rubiteHoe")
	.setTextureName("jakegems:rubiteHoe")
	.setCreativeTab(this.tabGemTools);

	//Sapphirite
	sapphiritePickaxe = new BasicPickaxe(this.sapphiritePickaxeID, toolGem)
	.setUnlocalizedName("sapphiritePickaxe")
	.setTextureName("jakegems:sapphiritePickaxe")
	.setCreativeTab(this.tabGemTools);

	sapphiriteShovel = new BasicShovel(this.sapphiriteShovelID, toolGem)
	.setUnlocalizedName("sapphiriteShovel")
	.setTextureName("jakegems:sapphiriteShovel")
	.setCreativeTab(this.tabGemTools);

	sapphiriteAxe = new BasicAxe(this.sapphiriteAxeID, toolGem)
	.setUnlocalizedName("sapphiriteAxe")
	.setTextureName("jakegems:sapphiriteAxe")
	.setCreativeTab(this.tabGemTools);

	sapphiriteSword = new BasicSword(this.sapphiriteSwordID, toolGem)
	.setUnlocalizedName("sapphiriteSword")
	.setTextureName("jakegems:sapphiriteSword")
	.setCreativeTab(this.tabGemTools);

	sapphiriteHoe = new BasicHoe(this.sapphiriteHoeID, toolGem)
	.setUnlocalizedName("sapphiriteHoe")
	.setTextureName("jakegems:sapphiriteHoe")
	.setCreativeTab(this.tabGemTools);

	//Emerite
	emeritePickaxe = new BasicPickaxe(this.emeritePickaxeID, toolGem)
	.setUnlocalizedName("emeritePickaxe")
	.setTextureName("jakegems:emeritePickaxe")
	.setCreativeTab(this.tabGemTools);

	emeriteShovel = new BasicShovel(this.emeriteShovelID, toolGem)
	.setUnlocalizedName("emeriteShovel")
	.setTextureName("jakegems:emeriteShovel")
	.setCreativeTab(this.tabGemTools);

	emeriteAxe = new BasicAxe(this.emeriteAxeID, toolGem)
	.setUnlocalizedName("emeriteAxe")
	.setTextureName("jakegems:emeriteAxe")
	.setCreativeTab(this.tabGemTools);

	emeriteSword = new BasicSword(this.emeriteSwordID, toolGem)
	.setUnlocalizedName("emeriteSword")
	.setTextureName("jakegems:emeriteSword")
	.setCreativeTab(this.tabGemTools);

	emeriteHoe = new BasicHoe(this.emeriteHoeID, toolGem)
	.setUnlocalizedName("emeriteHoe")
	.setTextureName("jakegems:emeriteHoe")
	.setCreativeTab(this.tabGemTools);

}

private void addBlocks() {

	blockRubite = new BasicBlock(this.blockRubiteID, Material.rock)
	.setUnlocalizedName("blockRubite")
	.setTextureName("jakegems:blockRubite")
	.setCreativeTab(this.tabGems);

	blockSapphirite = new BasicBlock(this.blockSapphiriteID, Material.rock)
	.setUnlocalizedName("blockSapphirite")
	.setTextureName("jakegems:blockSapphirite")
	.setCreativeTab(this.tabGems);

	blockEmerite = new BasicBlock(this.blockEmeriteID, Material.rock)
	.setUnlocalizedName("blockEmerite")
	.setTextureName("jakegems:blockEmerite")
	.setCreativeTab(this.tabGems);

	oreRubite = new OreRubite(this.oreRubiteID, Material.rock)
	.setUnlocalizedName("oreRubite")
	.setCreativeTab(this.tabGems);

	oreSapphirite = new OreSapphirite(this.oreSapphiriteID, Material.rock)
	.setUnlocalizedName("oreSapphirite")
	.setCreativeTab(this.tabGems);

	oreEmerite = new OreEmerite(this.oreEmeriteID, Material.rock)
	.setUnlocalizedName("oreEmerite")
	.setCreativeTab(this.tabGems);

	GameRegistry.registerBlock(blockRubite, "blockRubite");
	GameRegistry.registerBlock(blockSapphirite, "blockSapphirite");
	GameRegistry.registerBlock(blockEmerite, "blockEmerite");

	GameRegistry.registerBlock(oreRubite, "oreRubite");
	GameRegistry.registerBlock(oreSapphirite, "oreSapphirite");
	GameRegistry.registerBlock(oreEmerite, "oreEmerite");

	MinecraftForge.setBlockHarvestLevel(blockRubite, "pickaxe", 1);
	MinecraftForge.setBlockHarvestLevel(blockSapphirite, "pickaxe", 1);
	MinecraftForge.setBlockHarvestLevel(blockEmerite, "pickaxe", 1);
	MinecraftForge.setBlockHarvestLevel(oreRubite, "pickaxe", 2);
	MinecraftForge.setBlockHarvestLevel(oreSapphirite, "pickaxe", 2);
	MinecraftForge.setBlockHarvestLevel(oreEmerite, "pickaxe", 2);

}

private void addNames() {

	//Creative Tabs
	LanguageRegistry.instance().addStringLocalization("itemGroup.tabGems", "en_US", "RGB Gems");
	LanguageRegistry.instance().addStringLocalization("itemGroup.tabGemTools", "en_US", "Gem Tools");

	//Items
	LanguageRegistry.addName(gemRubite,"Rubite Gemstone");
	LanguageRegistry.addName(gemSapphirite,"Sapphirite Gemstone");
	LanguageRegistry.addName(gemEmerite,"Emerite Gemstone");

	//Tools
	LanguageRegistry.addName(rubitePickaxe,"Rubite Pickaxe");
	LanguageRegistry.addName(rubiteShovel,"Rubite Shovel");
	LanguageRegistry.addName(rubiteAxe,"Rubite Axe");
	LanguageRegistry.addName(rubiteSword,"Rubite Sword");
	LanguageRegistry.addName(rubiteHoe,"Rubite Hoe");

	LanguageRegistry.addName(sapphiritePickaxe,"Sapphirite Pickaxe");
	LanguageRegistry.addName(sapphiriteShovel,"Sapphirite Shovel");
	LanguageRegistry.addName(sapphiriteAxe,"Sapphirite Axe");
	LanguageRegistry.addName(sapphiriteSword,"Sapphirite Sword");
	LanguageRegistry.addName(sapphiriteHoe,"Sapphirite Hoe");

	LanguageRegistry.addName(emeritePickaxe,"Emerite Pickaxe");
	LanguageRegistry.addName(emeriteShovel,"Emerite Shovel");
	LanguageRegistry.addName(emeriteAxe,"Emerite Axe");
	LanguageRegistry.addName(emeriteSword,"Emerite Sword");
	LanguageRegistry.addName(emeriteHoe,"Emerite Hoe");

	//Blocks
	LanguageRegistry.addName(blockRubite,"Block of Rubite");
	LanguageRegistry.addName(blockSapphirite,"Block of Sapphirite");
	LanguageRegistry.addName(blockEmerite,"Block of Emerite");
	LanguageRegistry.addName(oreRubite,"Rubite Ore");
	LanguageRegistry.addName(oreSapphirite,"Sapphirite Ore");
	LanguageRegistry.addName(oreEmerite,"Emerite Ore");

}

private void addRecipes() {

	//Rubite
	GameRegistry.addRecipe(new ShapedOreRecipe(blockRubite, true, new Object[]{"FFF","FFF","FFF", Character.valueOf('F'), "gemRuby"}));

	GameRegistry.addRecipe(new ShapedOreRecipe(rubitePickaxe, true, new Object[]{"FFF", " X ", " X ", Character.valueOf('F'), "gemRuby", Character.valueOf('X'), Item.stick}));
	GameRegistry.addRecipe(new ShapedOreRecipe(rubiteShovel, true, new Object[]{" F ", " X ", " X ", Character.valueOf('F'), "gemRuby", Character.valueOf('X'), Item.stick}));
	GameRegistry.addRecipe(new ShapedOreRecipe(rubiteAxe, true, new Object[]{"FF ", "FX ", " X ", Character.valueOf('F'), "gemRuby", Character.valueOf('X'), Item.stick}));
	GameRegistry.addRecipe(new ShapedOreRecipe(rubiteSword, true, new Object[]{" F ", " F ", " X ", Character.valueOf('F'), "gemRuby", Character.valueOf('X'), Item.stick}));
	GameRegistry.addRecipe(new ShapedOreRecipe(rubiteHoe, true, new Object[]{"FF ", " X ", " X ", Character.valueOf('F'), "gemRuby", Character.valueOf('X'), Item.stick}));

	//Sapphirite
	GameRegistry.addRecipe(new ShapedOreRecipe(blockSapphirite, true, new Object[]{"FFF","FFF","FFF", Character.valueOf('F'), "gemSapphire"}));

	GameRegistry.addRecipe(new ShapedOreRecipe(sapphiritePickaxe, true, new Object[]{"FFF", " X ", " X ", Character.valueOf('F'), "gemSapphire", Character.valueOf('X'), Item.stick}));
	GameRegistry.addRecipe(new ShapedOreRecipe(sapphiriteShovel, true, new Object[]{" F ", " X ", " X ", Character.valueOf('F'), "gemSapphire", Character.valueOf('X'), Item.stick}));
	GameRegistry.addRecipe(new ShapedOreRecipe(sapphiriteAxe, true, new Object[]{"FF ", "FX ", " X ", Character.valueOf('F'), "gemSapphire", Character.valueOf('X'), Item.stick}));
	GameRegistry.addRecipe(new ShapedOreRecipe(sapphiriteSword, true, new Object[]{" F ", " F ", " X ", Character.valueOf('F'), "gemSapphire", Character.valueOf('X'), Item.stick}));
	GameRegistry.addRecipe(new ShapedOreRecipe(sapphiriteHoe, true, new Object[]{"FF ", " X ", " X ", Character.valueOf('F'), "gemSapphire", Character.valueOf('X'), Item.stick}));

	//Emerite
	GameRegistry.addRecipe(new ShapedOreRecipe(blockEmerite, true, new Object[]{"FFF","FFF","FFF", Character.valueOf('F'), "gemGreenSapphire"}));

	GameRegistry.addRecipe(new ShapedOreRecipe(emeritePickaxe, true, new Object[]{"FFF", " X ", " X ", Character.valueOf('F'), "gemGreenSapphire", Character.valueOf('X'), Item.stick}));
	GameRegistry.addRecipe(new ShapedOreRecipe(emeriteShovel, true, new Object[]{" F ", " X ", " X ", Character.valueOf('F'), "gemGreenSapphire", Character.valueOf('X'), Item.stick}));
	GameRegistry.addRecipe(new ShapedOreRecipe(emeriteAxe, true, new Object[]{"FF ", "FX ", " X ", Character.valueOf('F'), "gemGreenSapphire", Character.valueOf('X'), Item.stick}));
	GameRegistry.addRecipe(new ShapedOreRecipe(emeriteSword, true, new Object[]{" F ", " F ", " X ", Character.valueOf('F'), "gemGreenSapphire", Character.valueOf('X'), Item.stick}));
	GameRegistry.addRecipe(new ShapedOreRecipe(emeriteHoe, true, new Object[]{"FF ", " X ", " X ", Character.valueOf('F'), "gemGreenSapphire", Character.valueOf('X'), Item.stick}));

}

private void registerOreDictionary() {

	OreDictionary.registerOre("gemRuby", new ItemStack(gemRubite));
	OreDictionary.registerOre("gemSapphire", new ItemStack(gemSapphirite));
	OreDictionary.registerOre("gemGreenSapphire", new ItemStack(gemEmerite));

	OreDictionary.registerOre("oreRuby", new ItemStack(oreRubite));
	OreDictionary.registerOre("oreSapphire", new ItemStack(oreSapphirite));
	OreDictionary.registerOre("oreGreenSapphire", new ItemStack(oreEmerite));

}

@EventHandler
public void preInit(FMLPreInitializationEvent event) {

	this.initConfig(event);

	addItems();
	addBlocks();
	addNames();
}

@EventHandler
public void load (FMLInitializationEvent event) {

	proxy.registerRenderers();

	GameRegistry.registerWorldGenerator(new GemOreGenerator());

	registerOreDictionary();
}

@EventHandler
public void postInit (FMLPostInitializationEvent event) {

	addRecipes();

}

}

 

Hopefully that helps somewhat.

Posted

[me=Draco18s]sees no code[/me]

[me=Draco18s]shrugs and leaves, unable to locate problem.[/me]

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

I don't see what could be causing the issue you're seeing, but I will offer some tips in another area:

 

Drop all of those entries to the Language Registry.  Use a lang file instead.  It will make localization to other languages so much easier.

And it's so easy to do, too: https://github.com/Draco18s/Artifacts/blob/master/assets/artifacts/lang/en_US.lang

 

It's just unlocalized=localized one per line.  Eg:

 

itemGroup.tabGems=RGB Gems

 

Bam.  It just then needs to be a file named en_US.lang inside /assets/[MODID]/lang

 

Oh, also:

 

Configuration config = new Configuration(new File("config/Jake's Gems.cfg"));

Use

Configuration config = new Configuration(event.getSuggestedConfigurationFile());

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

Well thank you, those both sound quite helpful.

 

Indeed!  I had someone who wanted to translate my mods into Russian and so I poked around at language files and found out it was that easy.

 

Then, of course, I had to start using localized string calls in 400 places. xD

(All in item's addInformation() function, eg.

par3List.add(StatCollector.translateToLocal("effect.Activates several potion effects"));

instead of just

par3List.add("effect.Activates several potion effects");

)

But things like block, item, creative tab, and entity names, the translateToLocal() is called for you.  I just had a whole ton of places where it wasn't and those were almost more important than where it was done automatically!

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.