
Malkuthe
Members-
Posts
14 -
Joined
-
Last visited
Everything posted by Malkuthe
-
[1.7.2] onUpdate Method Not Being Called for Custom Item
Malkuthe replied to Malkuthe's topic in Modder Support
Eep. I haven't yet looked into breakpoints and have no idea how to use them. -
Hi! I'm having a bit of an issue, and were it, frankly, a more mundane one, I would have crashlogs to post, however, I do not. The game isn't crashing. onUpdate is simply not working. I thought it may have been the functionality I put into the code, however, even with just System.out.println("onUpdate is now working!") the console is not printing anything despite me having the item in my inventory. This is the item itself: ItemConsumingRage. This is the class it extends: SAAItemEmpowered. And this is the class that the class the item extends extends, which in turn extends Item... did that make any sense? SAAItem A thing to note is that an item that extends SAAItem alone seems to be working just fine. Another thing to note is that the onCreated method for ItemConsumingRage -is- being called, so I have no idea what the heck is going on. Anyone have any ideas?
-
[1.7.2] IIconRegistry Seems to Not be Working as Intended
Malkuthe replied to Malkuthe's topic in Modder Support
AAGH. I realized that this morning. It was such a stupid mistake. *flails* -
I recently updated my mod from 1.6.4 to 1.7.2, and got rid of all the errors and updated all my methods. I was honestly expecting really difficult problems to appear, and they did. However, they did not occur at all where I was expecting them( read: PacketHandler and/or my XMLconfig for one of the modfeatures) the problems occurred with my items and registering their icons. In the IIconRegister methods, I put System.out.println(icons[i]); . Unless things are being handled differently in 1.7.2, my console should have the icons printed out, it doesn't. Opening the creative inventory is alright. Accessing my custom tab, however, is not. The items seem to crash the game whenever a gui is opened that is supposed to render them, throwing an NPE. This is the crash in question: [LINK] The item class in question is this: [LINK] I'm not entirely sure what to do at this point...
-
[1.6.4] Attaching NBT Data to Crafting Result Based on Recipe Items
Malkuthe replied to Malkuthe's topic in Modder Support
Yaay! It works now! I had to do a little fiddling around with the code too. Turns out part of the reason for the crash was that I was just taking the item out of the creative inventory and therefore it had no NBT Tag Compound associated with it. I fixed that part with a quick modification to the onUpdate method and made it so that if the item tag compound of the item is null, to set "Owner" to "none" by default. Thanks so much for the help! Sorry for the relentless questions. I'm trying to learn as much as I can as fast as I can. -
[1.6.4] Attaching NBT Data to Crafting Result Based on Recipe Items
Malkuthe replied to Malkuthe's topic in Modder Support
I seem to be running headlong into problems all day today. I got the thing working... sort of. http://pastebin.com/WCqYX6yC That's the crash report. The full item class is over here: https://github.com/Malkuthe/BattleClasses/blob/master/battleclassmod/items/BoonItem.java#L68 It may have to do with rendering the object in the player's hand. The reason I say that is because the item is perfectly fine in my inventory. However, another issue is that instead of displaying a sprite, minecraft displays the no-icon texture. Anyway, the one with the iconIndex[1] works just fine rendering in the hand, but as soon as the one with iconIndex[0] is selected, minecraft crashes. I'm not sure what's going on. -
[1.6.4] Attaching NBT Data to Crafting Result Based on Recipe Items
Malkuthe replied to Malkuthe's topic in Modder Support
Ohhhhh. THAT was it. >_> I forgot to define it. . Whoops. Thank you! -
[1.6.4] Attaching NBT Data to Crafting Result Based on Recipe Items
Malkuthe replied to Malkuthe's topic in Modder Support
*flails* @Override @SideOnly(Side.CLIENT) public void registerIcons(IconRegister register){ Icon[] iconArray = new Icon[2]; //registering the two icons iconArray[0] = register.registerIcon(BCMInfo.ID + ":" + getUnlocalizedName()); iconArray[1] = register.registerIcon(BCMInfo.ID + ":" + getUnlocalizedName() + "Active"); } @Override @SideOnly(Side.CLIENT) public Icon getIcon(ItemStack itemstack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining){ NBTTagCompound properties = itemstack.stackTagCompound; if (!properties.getString("Owner").isEmpty()){ return iconArray[1]; } else { return iconArray[0]; } } I have a new problem. I have no idea what I'm doing wrong, but Eclipse is telling me that where I return the iconArray[] that it cannot be resolved to a variable. *is confused* -
[1.6.4] Attaching NBT Data to Crafting Result Based on Recipe Items
Malkuthe replied to Malkuthe's topic in Modder Support
Yeaah. I don't think the config that comes with forge has the functionality we need. That other config is still useful for the basic stuff though. *nodnods* I'll get back to everyone if I manage to pull it off with the configurability, but for now, I'll do the easy way of defining jobs and then, when I have that done, I'll start working on making it all configurable. Sidenote: I call the jobs classes in the mod, but because talking java, well, it would get really confusing really fast. . -
[1.6.4] Attaching NBT Data to Crafting Result Based on Recipe Items
Malkuthe replied to Malkuthe's topic in Modder Support
*nods* The problem is, that's perfectly fine for hard-coded jobs, which, in hindsight, are the better and far nicer way to go at this point in time. However, one of the features on the feature-list my friend -- who'll be working on the project with me eventually -- and I compiled is the ability to create jobs through a config file. Unless there's a way to automatically create a subclass from the input of a config file... *shakes his feature-list for being ambitious* -
[1.6.4] Attaching NBT Data to Crafting Result Based on Recipe Items
Malkuthe replied to Malkuthe's topic in Modder Support
So I was looking around, and I have no idea if the way I'm planning to do this will work. I'm not even sure exactly how to do it just yet, being a newbie to Java and all... However, I have something in mind, and I may need some help implementing it. The fact that I want this thing to be configurable is beating me up. . So, first, and obviously not done in the same class would be retrieving the number of player jobs that are configured. So that should be an integer. Say it's something like below. For now I'll set an arbitrary integer as its value. public static final int NUMBER_OF_JOBS = 4; Then, this is what I currently have written down on Eclipse after the above.: public static void Init(){ String[] jobNames = { //This is just arbitrary. In the future I'd like to pull these values from the config. "Knight", "Thief", "Mage", "Archer" } HashMap<String, Object> jobmap = new HashMap<String, Object>(); for (int i = 0; i < NUMBER_OF_CLASSES; ++i){ jobmap.put(jobKeys[i], *jobRecipes*); } } Where *jobRecipes* are to be the arrays of the "recipes" so to speak, and it's at this point that I am stuck because what I want to do next is a for loop with an if statement that checks the "recipes" against the hashmap key, and if the recipes match, sets the job NBT data to the same as the key... I'm beginning to think it's worth the effort to create a custom block instead... -
[1.6.4] Attaching NBT Data to Crafting Result Based on Recipe Items
Malkuthe replied to Malkuthe's topic in Modder Support
Oooh! Thank you so much! I was a bit confused at first but I think I understand what you're doing. *nods* Correct me if I'm wrong, but am I right in assuming that this code goes where I register my items/recipes? Also, what you are doing is basically attaching the specific ingredients used to the resulting item as NBT data, right? I'm trying to reason out how to do this only AND ONLY for specific item combinations, while the recipe won't exist for others. Say, Three diamond swords plus one bow wouldn't work, but four diamond swords or two diamond swords and two bows would. *ponders* -
Hi! I guess the title is fairly self-explanatory, but I feel the need to elaborate so as to avoid any confusion. My question pretty much boils down to: "Is there a way to attach NBT data to the result of a vanilla crafting recipe based on the items used therein?" I've been trying to find something along these lines for the past two hours or so, but to no avail. (granted, I may have been trying out the wrong keywords...) More elaboration: I have an item I call a Boon, and based on the items used in its crafting recipe, it can take on different 'jobs' so to speak. For example, using four Diamond Swords makes it a Boon with job: "Knight", or four bows for a Boon with job: "Archer". Is there a way to do this using vanilla crafting or do I have to come up with my own method of crafting the item?