Posted March 30, 201510 yr Hello! I am making a technical mod, I know a lot in GUI, Models, Blocks, but I know a little bit in Items... =( And I want to make a Battery that shows a Durability Bar and this bar represents it's energy like this photo: http://vignette2.wikia.nocookie.net/mctechnicpack/images/6/6f/Powering_a_machine.png/revision/latest?cb=20120311220125[/img] and when I add the item to the GUI(Allready made) you see the bar depleting just like some technical mods.(Like it is damaging the Item) Thanks!
March 30, 201510 yr Author You can return whatever value you want for the durability bar. Use the showDurabilityBar and getDurabilityForDisplay methods in your Item for that. I know about that, I've also created a ToolMaterial, but I can't assign a material to a normal Item that has no "abilities"(Sword, Hoe, Pickaxe...) So How do I do that?
March 30, 201510 yr ScratchForFun on youtube actually made a few videos covering the creation of battery's and such. You should check them out! I am not a cat. I know my profile picture is sexy and amazing beyond anything you could imagine but my cat like features only persist in my fierce eyes. I might be a cat.
March 30, 201510 yr Author ScratchForFun on youtube actually made a few videos covering the creation of battery's and such. You should check them out! Allready checked! But they are [1.6.4] so It won't work on 1.7.10, also, I think I found a way...
March 30, 201510 yr Author This has nothing to do with a tool material or Item damage. In that 2nd method you posted you can return ANY value you want. Be it the actual damage value or some data you get out of the NBT of the ItemStack or even the current room temperature (in lack of a better example). My idea was using a Material for the Item - MaxDurability as the MaxPower - Durability as CurrentPower - but the way I found was: create 2 variables: MaxPower and Power both defined, then on getDurabilityBarForDisplay I divide them Power/MaxPower, it gives me what I want, but using another block, how can I change this variables?
March 31, 201510 yr Block is an item when in inventory. Extend an ItemBlock class and register your block with it. Then you could do the same thing as a normal Item. Author of Tao Land Mod. http://taoland.herbix.me/images/1/14/TaoLandLogo.png[/img] Also, author of RenderTo ---- I'm not an English native speaker. I just try my best.
March 31, 201510 yr Then if you want to change it, well, just change it. 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.
March 31, 201510 yr Author Got It in a Very Very Very Stupid Way! I made the Item as a pickaxe and I used ToolMaterial in it adding Durability as Power, and when you add the Item to the GUI I made, it uses slot[0].setItemDamage(slot[0].getItemDamage() + 10) so it damages the item trought time it is there and add power, when the Item has no Durability it won't add. So, latest problem is: How can I slow down The For?! For Code: if(ItemStack.areItemStacksEqual(slots[0], new ItemStack(ITEM))) { if(slots[0].getItemDamage() >= slots[0].getMaxDamage()) { } else { for(i=0;i<10000;i++){ power = power+1; slots[0].setItemDamage(slots[0].getItemDamage() + 1); } } How can I slow this down? Also, make the ToolMaterial worse than Gold and Wood, it does no damaged to blocks!
March 31, 201510 yr Do not create a new ItemStack in order to compare the itemstack's item. Use ItemStack.getItem() 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.
March 31, 201510 yr Author I just want to slow down the power add, the ToolMaterial works for every block that needs power, but if I use as a normal variable, I can't change it using a TileEntity, that's why a ToolMaterial, also, I don't need to save things into NBTTAG, the game saves auto then.
March 31, 201510 yr Author You do not need to use ToolMaterial to use ItemDamage. Not sure I get what you said there with NBT. About slowing it down, just increase/decrease less often (e.g. only every 3rd tick). Just Inclrease/decreate what? That's True I don't need to Use ToolMaterial Fort that... Trying with "setMaxDamage"
March 31, 201510 yr RESULT: Without ToolMaterial the game Crashes before Mojang Logo You're probably trying to extend ItemTool, which you do not need to do, in order for items to have durability. ALL ITEMS have the possibility of having a damage value. 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.
March 31, 201510 yr Author Sorry, it was a Stupid Error! =( I forgot to make if(slots[0] !=null) so then CRASH, but now worked, I used setMaxDamage(int); on the Item and it worked, perfectly! Now just need the "slow down" on the power adding(means that when I add power it will slowly add, not add in one single tick)
March 31, 201510 yr onUpdate { takeALittlePower(); } takeALittlePower() { power += 1; slot[0].damageItem(1); } 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.
March 31, 201510 yr Author onUpdate { takeALittlePower(); } takeALittlePower() { power += 1; slot[0].damageItem(1); } Thanks For that! Worked!
March 31, 201510 yr 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.