Jump to content

ax1m

Members
  • Posts

    13
  • Joined

  • Last visited

Converted

  • Gender
    Male
  • Location
    Switzerland
  • Personal Text
    I do stuff and sometimes things, too.

ax1m's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. But that's what I'm trying to do already, so wouldn't that just get me right back to not being able to cast an Object to a char?
  2. Sorry if this is a really noobish question, but how would I go about declaring an array with alternating char and String type elements?
  3. I'm trying to modularize the way I add recipes to my mod, in order to cut down on all the duplicate code I've been writing. I've seen examples around the internet of people using an Object array to pass crafting pattern and ingredients, but for some reason I can't get it to work, as it keeps crashing on startup. Here's the code where it crashes: package ch.ax1m.aximtech.init; // SNIP - imports public class Recipes { // SNIP - init method and other stuff private static void addToolRecipe(ItemToolAT tool) { String mat = tool.getOreMaterial(); Object[] pattern = null; switch(Reference.ToolData.toolTypes.indexOf(tool.getToolType())) { case 0: pattern = new Object[] { "hXf", " X ", " I ", 'h', "hammer", 'f', "file" }; break; // SNIP - other tool types } GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(tool), pattern, 'X', "ingot" + mat, 'P', "plate" + mat, 'R', "rod" + mat, 'I', "stickWood")); } } And this is the top of the stacktrace: java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to java.lang.Character at net.minecraftforge.oredict.ShapedOreRecipe.<init>(ShapedOreRecipe.java:89) at ch.ax1m.aximtech.init.Recipes.addToolRecipe(Recipes.java:110) at ch.ax1m.aximtech.init.Recipes.init(Recipes.java:42) at ch.ax1m.aximtech.AximTech.init(AximTech.java:46) I also tried wrapping the chars in my pattern Object in Character.valueOf(), as I've seen in a couple examples, but that didn't change anything, still gives me the same error.
  4. Thanks, that definitely looks very useful. Now if I only want to color part of a texture (like color only the tool head, and have the handle stay brown), is there a method for that as well or do I have to implement that myself?
  5. alright thanks, I'll have a look at that
  6. Can't find anything of that name, did you perhaps mean IItemRenderer?
  7. I'm currently working on my mods textures and I'm really annoyed with how inefficient this seems, both in terms of time used and file size created. I basically have a default texture for each tool and item, and then just apply coloring layers to that based on the material. What I would like to do is give it just the default textures instead, define the color values and masks in my code and have it parse all the textures during initialization. I know it has to be possible somehow (right?), but I just have no clue where to even start looking. I'd really appreciate some pointers in the right direction from the pros on here
  8. I see, thanks that fixed the issue. So what's the purpose of the jar task then? That's the one I was using to build a jar before
  9. I'm running into a weird new issue now. The mod works fine when I launch it in IDEA, but when I build the jar and run it in a modpack (I tested both my full pack as well as a barebones testpack with just NEI, minetweaker and a couple core-mods) it crashes as soon as I start breaking a block: What's the issue here? Did I do something wrong in building the jar?
  10. well, derpy me, don't know how I overlooked that ^^ thanks again for your help, I got it all working as intended now
  11. okay so bear with me, I think I managed to do it for BreakSpeed by changing it to speed.block, but it looks like HarvestDropEvent doesn't pass the block as a variable at all, only an ArrayList of ItemStacks that are about to drop. Problem is I don't know how to compare two ItemStacks, ItemStack.iron_ore doesn't seem to be the correct way... I tried looking at the ItemStack class but that's just a bit too daunting for right now.
  12. Thanks for your input! May I ask which forge version that code is written for? I'm using 1558 and I'm getting an import error on the last line of imports, and then it can't resolve the .state variable for both HarvestDropsEvent and BreakSpeed
  13. So, I'm writing a little tweak mod for my modpack. I'm trying to increase the harvest level for iron ore to require an iron pickaxe (it makes sense trust me) and after a quick google search I found several code examples doing similar things using the Block.setHarvestLevel method, so I decided to try that. Here's my code so far: package com.ax1m.aximtweaks; import net.minecraft.init.Blocks; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.event.FMLPostInitializationEvent; @Mod(modid = AximTweaks.MODID, version = AximTweaks.VERSION) public class AximTweaks { public static final String MODID = "AximTweaks"; public static final String VERSION = "0.0"; @EventHandler public void init(FMLPostInitializationEvent event) { System.out.println("Increasing iron ore harvest level"); Blocks.iron_ore.setHarvestLevel("pickaxe", 2); } } And here is the log from starting the thing. As you can see it printed the log message I put in the code, however when I try it in game, a stone pickaxe will still harvest iron ore just fine. What went wrong here?
×
×
  • Create New...

Important Information

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