BLourenco
Members-
Posts
11 -
Joined
-
Last visited
Converted
-
Gender
Undisclosed
-
Personal Text
I am new!
BLourenco's Achievements
Tree Puncher (2/8)
4
Reputation
-
MinecraftForge.setBlockHarvestLevel() not working in-game
BLourenco replied to BLourenco's topic in Modder Support
I tried messing around with it a bit more, still no luck. When I print the block's harvest level before and after setting the harvest levels using .getBlockHarvestLevel(), it first prints the block's default value (-1 for new blocks), but it prints the correct level afterwards. But then when I go in-game, nothing has happened. -
When you add a recipe it should be something similar to this: GameRegistry.addRecipe(new ItemStack(TNTSword), new Object[] {"X", "X", "Y", 'X', Block.tnt, 'Y', Item.stick}); From what I can tell, it seems you are passing the TNT block as the character that is supposed to represent it.
-
MinecraftForge.setBlockHarvestLevel() not working in-game
BLourenco posted a topic in Modder Support
I'm trying to set harvest levels for my new blocks and some vanilla blocks, but it doesn't seem to work. All the vanilla blocks still have their old harvest levels, and my blocks all have a harvest level of -1 (default value, I think). My tools are working properly, as I can set my wooden pick to have a level of 10 and it can mine everything, but when I put it back to 0, it can only mine the blocks it normally can and any of my new blocks. I have all my .setBlockHarvestLevel() calls in one method in my mod's "Block" class, and I've tried calling it at different points in my code, like before/after my blocks are registered, or in my load or postInit methods. Here's my mod class: package blourenco.minermetals; import blourenco.minermetals.handler.FuelHandlerMM; import blourenco.minermetals.item.crafting.RecipesMM; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.Init; import cpw.mods.fml.common.Mod.Instance; import cpw.mods.fml.common.Mod.PostInit; import cpw.mods.fml.common.Mod.PreInit; 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; @Mod(modid = MinerMetals.modid, name = "Miner Metals", version = "0.1a") @NetworkMod(clientSideRequired = true, serverSideRequired = false) public class MinerMetals { public static final String modid = "BLourenco_MinerMetals"; @Instance(MinerMetals.modid) public static MinerMetals instance; @SidedProxy (clientSide="blourenco.minermetals.client.ClientProxy", serverSide="blourenco.MinerMetals.CommonProxy") public static CommonProxy proxy; @PreInit public void preInit(FMLPreInitializationEvent event) { //Blocks MinerMetalsBlock.initBlocks(); MinerMetalsBlock.setBlockHarvestLevels(); MinerMetalsBlock.reflectVanillaBlocks(); MinerMetalsBlock.registerBlocks(); //Items MinerMetalsItem.initItems(); MinerMetalsItem.reflectVanillaItems(); //Recipes RecipesMM.registerRecipes(); //Names proxy.registerTranslations(); } @Init public void load(FMLInitializationEvent event) { proxy.registerRenderInformation(); GameRegistry.registerFuelHandler(new FuelHandlerMM()); } @PostInit public void postInit(FMLPostInitializationEvent event) { RecipesMM.removeVanillaRecipes(); } } Here's my method to set harvest levels: public static void setBlockHarvestLevels() { MinecraftForge.setBlockHarvestLevel(MinerMetalsBlock.blockCoal, "pickaxe", 0); MinecraftForge.setBlockHarvestLevel(Block.oreNetherQuartz, "pickaxe", 1); MinecraftForge.setBlockHarvestLevel(MinerMetalsBlock.oreCopper, "pickaxe", 1); MinecraftForge.setBlockHarvestLevel(MinerMetalsBlock.blockCopper, "pickaxe", 1); MinecraftForge.setBlockHarvestLevel(MinerMetalsBlock.oreTin, "pickaxe", 1); MinecraftForge.setBlockHarvestLevel(MinerMetalsBlock.blockTin, "pickaxe", 1); MinecraftForge.setBlockHarvestLevel(Block.oreIron, "pickaxe", 2); MinecraftForge.setBlockHarvestLevel(Block.oreGold, "pickaxe", 2); MinecraftForge.setBlockHarvestLevel(Block.blockGold, "pickaxe", 2); MinecraftForge.setBlockHarvestLevel(Block.blockIron, "pickaxe", 2); MinecraftForge.setBlockHarvestLevel(MinerMetalsBlock.oreSilver, "pickaxe", 2); MinecraftForge.setBlockHarvestLevel(MinerMetalsBlock.blockSilver, "pickaxe", 2); MinecraftForge.setBlockHarvestLevel(MinerMetalsBlock.blockBronze, "pickaxe", 2); MinecraftForge.setBlockHarvestLevel(Block.oreEmerald, "pickaxe", 3); MinecraftForge.setBlockHarvestLevel(Block.blockEmerald, "pickaxe", 3); MinecraftForge.setBlockHarvestLevel(Block.oreRedstone, "pickaxe", 3); MinecraftForge.setBlockHarvestLevel(Block.oreDiamond, "pickaxe", 4); MinecraftForge.setBlockHarvestLevel(Block.blockDiamond, "pickaxe", 4); MinecraftForge.setBlockHarvestLevel(MinerMetalsBlock.obsidian, "pickaxe", 4); MinecraftForge.setBlockHarvestLevel(MinerMetalsBlock.oreNetherite, "pickaxe", 4); MinecraftForge.setBlockHarvestLevel(MinerMetalsBlock.blockNetherite, "pickaxe", 4); } I just know it's going to be some stupid small thing, but I've been trying to fix this all day, and I've been Googling it as well, but no luck. -
Wouldn't that be creating new items? I just want to change the icons for iron armor, tools, and ingots, and change their EnumToolMaterial and EnumArmorMaterial, not create replacements and recreate all the recipes. Harvest Level is like what quality tool you need to harvest it. In the code it's set up like this: 0: Wood, Gold 1: Stone 2: Iron 3: Diamond I have made my own materials that use levels 4 and 5. Here's what I made: 0: Wood 1: Stone 2: Bronze, Silver, Gold 3: Iron 4: Steel 5: Diamond, Obsidian So now some blocks need to change their harvest levels so that you can't mine Obsidian with my new Iron. Thanks, that's what I'll do. I'm sure most of the stuff is relatively simple, it's just knowing the right keywords (like hook and reflection). Thanks, again.
-
Wouldn't that be creating new items? I just want to change the icons for iron armor, tools, and ingots, and change their EnumToolMaterial and EnumArmorMaterial, not create replacements and recreate all the recipes. Harvest Level is like what quality tool you need to harvest it. In the code it's set up like this: 0: Wood, Gold 1: Stone 2: Iron 3: Diamond I have made my own materials that use levels 4 and 5. Here's what I made: 0: Wood 1: Stone 2: Bronze, Silver, Gold 3: Iron 4: Steel 5: Diamond, Obsidian So now some blocks need to change their harvest levels so that you can't mine Obsidian with my new Iron. Thanks, that's what I'll do. I'm sure most of the stuff is relatively simple, it's just knowing the right keywords (like hook and reflection). Thanks, again.
-
When it comes to adding new block and items, there are plenty of guides and tutorials, but I'm having a really hard time finding out how to properly edit blocks and items from Vanilla Minecraft. I just found how to remove old recipes, because all my searches lead to tutorials for new blocks and items because of keywords. Anyways, here's what I want to do next: Change the icons of Iron tools and armour to something new, since I will be using those for Steel tools and armour. Change old tools and armour to new toolMaterials and armorMaterials (which I have already added) Change old blocks to different harvestLevels (I have added pickaxes with levels 4 and 5) Change Obsidian to drop a certain quantity of items I don't think these should be too difficult to actually code, I'm just having a real hard time searching for this specific information in the ocean of basic tutorials. If anyone can point me in the right direction, that'd be awesome. Thanks!
-
When it comes to adding new block and items, there are plenty of guides and tutorials, but I'm having a really hard time finding out how to properly edit blocks and items from Vanilla Minecraft. I just found how to remove old recipes, because all my searches lead to tutorials for new blocks and items because of keywords. Anyways, here's what I want to do next: Change the icons of Iron tools and armour to something new, since I will be using those for Steel tools and armour. Change old tools and armour to new toolMaterials and armorMaterials (which I have already added) Change old blocks to different harvestLevels (I have added pickaxes with levels 4 and 5) Change Obsidian to drop a certain quantity of items I don't think these should be too difficult to actually code, I'm just having a real hard time searching for this specific information in the ocean of basic tutorials. If anyone can point me in the right direction, that'd be awesome. Thanks!
-
I've been doing the same thing, trying to remove the recipe for the Golden Sword. The method seems to work for ShapelessRecipes (I tried (Item.book) and (Item.planks, 4)), but doesn't work for ShapedRecipes ((Item.stick, 4), (Item.jukebox), (Item.swordGold)). I'm thinking something's changed since the code was posted. My method call: removeRecipe(new ItemStack(Item.swordGold)); The Method: private static void removeRecipe(ItemStack resultItem) //Code by yope_fried inspired by pigalot { ItemStack recipeResult = null; ArrayList recipes = (ArrayList) CraftingManager.getInstance().getRecipeList(); for (int scan = 0; scan < recipes.size(); scan++) { IRecipe tmpRecipe = (IRecipe) recipes.get(scan); if (tmpRecipe instanceof ShapedRecipes) { ShapedRecipes recipe = (ShapedRecipes)tmpRecipe; recipeResult = recipe.getRecipeOutput(); } else if (tmpRecipe instanceof ShapelessRecipes) { ShapelessRecipes recipe = (ShapelessRecipes)tmpRecipe; recipeResult = recipe.getRecipeOutput(); } if (ItemStack.areItemStacksEqual(resultItem, recipeResult)) { System.out.println("Removed Recipe: " + recipes.get(scan) + " -> " + recipeResult); recipes.remove(scan); } } } EDIT: I got it to work, though I'm not sure if it is safe or not. I simply don't check what the recipe is an instance of anymore: private static void removeRecipe(ItemStack resultItem) //Code by yope_fried inspired by pigalot { ItemStack recipeResult = null; ArrayList recipes = (ArrayList) CraftingManager.getInstance().getRecipeList(); for (int scan = 0; scan < recipes.size(); scan++) { IRecipe tmpRecipe = (IRecipe) recipes.get(scan); recipeResult = tmpRecipe.getRecipeOutput(); if (ItemStack.areItemStacksEqual(resultItem, recipeResult)) { System.out.println("Removed Recipe: " + recipes.get(scan) + " -> " + recipeResult); recipes.remove(scan); } } }
-
I've been doing the same thing, trying to remove the recipe for the Golden Sword. The method seems to work for ShapelessRecipes (I tried (Item.book) and (Item.planks, 4)), but doesn't work for ShapedRecipes ((Item.stick, 4), (Item.jukebox), (Item.swordGold)). I'm thinking something's changed since the code was posted. My method call: removeRecipe(new ItemStack(Item.swordGold)); The Method: private static void removeRecipe(ItemStack resultItem) //Code by yope_fried inspired by pigalot { ItemStack recipeResult = null; ArrayList recipes = (ArrayList) CraftingManager.getInstance().getRecipeList(); for (int scan = 0; scan < recipes.size(); scan++) { IRecipe tmpRecipe = (IRecipe) recipes.get(scan); if (tmpRecipe instanceof ShapedRecipes) { ShapedRecipes recipe = (ShapedRecipes)tmpRecipe; recipeResult = recipe.getRecipeOutput(); } else if (tmpRecipe instanceof ShapelessRecipes) { ShapelessRecipes recipe = (ShapelessRecipes)tmpRecipe; recipeResult = recipe.getRecipeOutput(); } if (ItemStack.areItemStacksEqual(resultItem, recipeResult)) { System.out.println("Removed Recipe: " + recipes.get(scan) + " -> " + recipeResult); recipes.remove(scan); } } } EDIT: I got it to work, though I'm not sure if it is safe or not. I simply don't check what the recipe is an instance of anymore: private static void removeRecipe(ItemStack resultItem) //Code by yope_fried inspired by pigalot { ItemStack recipeResult = null; ArrayList recipes = (ArrayList) CraftingManager.getInstance().getRecipeList(); for (int scan = 0; scan < recipes.size(); scan++) { IRecipe tmpRecipe = (IRecipe) recipes.get(scan); recipeResult = tmpRecipe.getRecipeOutput(); if (ItemStack.areItemStacksEqual(resultItem, recipeResult)) { System.out.println("Removed Recipe: " + recipes.get(scan) + " -> " + recipeResult); recipes.remove(scan); } } }