decebaldecebal
Members-
Posts
47 -
Joined
-
Last visited
Everything posted by decebaldecebal
-
Sword damage/tool efficiency based on NBT
decebaldecebal replied to decebaldecebal's topic in Modder Support
I looked at Modular Powersuits source code and I've created an hitEntity function that works but I am not sure if I am doing things properly. @Override public boolean hitEntity(ItemStack par1ItemStack, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase) { if (this.getDamage(par1ItemStack) >= 998) return false; float damage = weaponDamage; if(par1ItemStack.hasTagCompound()) { System.out.println("works"); if(par1ItemStack.getTagCompound().getInteger("speed")==1) { System.out.println("works1"); damage+=2.0F; } } DamageSource damagesource = DamageSource.causePlayerDamage((EntityPlayer)par3EntityLivingBase); par2EntityLivingBase.attackEntityFrom(damagesource, damage); par1ItemStack.damageItem(1, par3EntityLivingBase); return true; } -
Hello, Like the title says, I want to set a swords damage vs entity to a value in an NBT tag. I have a sword with a container item where you can insert a specific item in a slot and based on that item I am writing NBT data to the sword item.I have searched in the ItemSword and Item class but I could not find a functions that allows this.All the functions that deal with damage are called once when the game is loaded. Also I have anther questions that is related to this one.I want to make a pickaxe that changes the efficiencyOnProperMaterial field based on NBT data like the sword, but I could not find how to do this either. I plan to make a hole set of tools that have a container and that change certain aspects of them like damage vs entity, efficiency and total damage(which I know how to set because there is a function for that in the Item class). Why aren't there such functions or the damage vs entity and efficiency in the Item class or ItemTool class or am I just missing them? Thank you for your help. EDIT: Is it also possible to add an enchantment effect based on NBT? EDIT 2: Sorry for so many edits, but I just want to ask you your opinion on this piece of code: @Override public boolean onBlockStartBreak(ItemStack itemstack, int X, int Y, int Z, EntityPlayer player) { if (this.getDamage(itemstack) >= 498 && player.capabilities.isCreativeMode == false) return true; return false; } Currently I use this method on my custom pickaxe.My pickaxe is unbreakable and uses a custom fuel I made to recharge it's durability.My question is: Is there a better way to do it so the tool is indestructible and only works if it is recharged with my custom fuel? Sorry for all these questions, haven't posted on this forum for a while and now I remember all the problems I wanted to ask here but found a solution myself for them
-
[1.6.2]Armor rendering textures not working in MC
decebaldecebal replied to decebaldecebal's topic in Modder Support
I'll try but I do not promise anything. Also I solved the texture problem by doing...nothing, it just works now for some weird reason... -
Hello, So I managed to install the latest version of MC Forge using the tutorial Pahimar made.I managed to get his dev environment working and items/blocks textures working as well. Basically everything works in Eclipse, even the armor textures. I got to mention that the path for the textures in Eclipse is different from the path in MC when you export the mod. To help other people, here is a screenshot of my dev environment: My problem is that the armor textures that are rendered on the player DO NOT work in MINECRAFT.They do work in Eclipse though. Now comes the strange part, in the screenshot I also showed you how I set up one of my custom GUIs and I do it the same as the armor textures files.The thing is that the GUI texture WORKS in MC, but the armor DOES NOT, although they use exactly the same mechanic... I am really stuck on this one guys, help would be much appreciated.
-
I have managed to do it using the transferStackInSlot() function.Thanks fro the help guys.
-
Well I already have a custom transferStackInSlot() funtion that I got from an Open Source mod, and I tried to modify it so that it checks for the itemID of the item that is picked up and compares it to the items I want to be accept, but it does not seem to work...
-
I have made a new Inventory with a custom Slot and Container.I managed to restrict what items go in that slot, but only if you pick up the item from your inventory and try to place it in the slot. If you shift click an item, it goes in that slot regardless if it is allowed there or not.I have used the isItemValid(ItemStack par1ItemStack) to restrict items in the Slot class, but what function do I have to use to also restrict what items can be shift clicked in that slot?I have searched through the Slot class, but couldn't find any function that does that...
-
[Unsolved] How to make an armor using Forge for SMP?
decebaldecebal replied to Soviet's topic in Modder Support
In the new version you have to use the getArmorTexture() function from the Item class to your armor item calss.Here is an example on how to use it:(took from my own mod) Also when you register the armor you have to do it like so: reinforcedBoots = new ReinforcedBoots(reBoots, ReinforcedArmorMaterial, RenderingRegistry.addNewArmourRendererPrefix("reinforced"), 3).setUnlocalizedName("reinforcedboots").setCreativeTab(CreativeTabs.tabCombat); Notice the RenderingRegistry added there with a custom name you want. It works perfectly fine for me, with no errors. -
For that you just need to check when the player right clicks, store that state in a boolean, so when he right clicks one time, the boolean is true, and the second time it is false, then just put check for the variable if it is true in the registerIcons() function, and set a new texture based on the state of the variable.
-
Give blocks with TE extra info when in inventory?
decebaldecebal replied to Chibill's topic in Modder Support
You need to use NBT to save custom data.And that depends on what type of data you want to save.If it is just a boolean or an int, it is rather easy, but for more complex information, it can be quite difficult.I recommend looking at open source mods, like BuildCraft or Thinkers Construct on how to do it. -
[Solved]Multi texture block bug in inventory
decebaldecebal replied to decebaldecebal's topic in Modder Support
OK, so it seems that everything is fixed now.For the side, I added another check when the metadata is 0 and the side is 3, and that seems to work perfectly fine, in the inventory it looks like the furnace, and in the world everything works perfectly. Also I added to the NBT data what Homletmoo said: Thanks for the help guys! -
[Solved]Multi texture block bug in inventory
decebaldecebal replied to decebaldecebal's topic in Modder Support
Well the metada of the block is 0, so I will try to check if the metadata is 0 and render that texture, but the problem is how to stop this happening in the world also.I will try it and see if it works. -
[Solved]Multi texture block bug in inventory
decebaldecebal replied to decebaldecebal's topic in Modder Support
Well I kind of tested it with a normal furnace and couldn't find any problem with the animation, maybe the fuel I used didn't burn for long enough if you say that this happens with Vanilla too... -
Hello forge community, I have created a multi textured block that is based on the furnace code.It basically works the same as the furnace, but with different recipes.The problem I have is that the texture on the block works well when it is placed in the world, but when it is in my hand or inventory, the texture does not render correctly.Here is a screenshot that shows exactly what I mean: The code to my block class is located here: http://pastebin.com/eeMPk18v Any help with this would be greatly appreciated. Also, I have found another small bug with this block.I have made some custom fuels that can run into this custom furnace, some of them which have a very long burn time.The bug I found is that if I have an item that burns for let's say 30 seconds, and it burns half way through, after I exit the world and re-log back in, the flaming animation from the furnace fuel progress bar is back in the starting position, and not in the middle as it was before.After I wait another 14 seconds, the flame starts to go down very fast and finally it stops when the item is fully burned.I have no idea how to fix this bug. I repeat that I have done exactly everything as the furnace does things, but it seems to not work properly.
-
Who can create or knows how to code a NEI plugin?
decebaldecebal replied to Mark719's topic in Modder Support
I am also interested in this matter.I have made a mod that adds new machines and people do not know what recipes they offer so creating a plugin for NEI will be such a useful thing...To bad I can't find any tutorials out there... -
Replace this line: public static final Item Helmet_ShinyGold = (new ItemArmor(2006, EnumArmorMaterial.SHINYGOLD ,5,0 ).setItemName("Shiny Gold Helmet"));\ With: public static final Item Helmet_ShinyGold = (new ItemArmor(2006, EnumArmorMaterial.SHINYGOLD ,RenderingRegistry.addNewArmourRendererPrefix("AN_ARMOR_NAME"),0 ).setItemName("Shiny Gold Helmet")); And also in your item class add: public String getArmorTextureFile(ItemStack par1) { return "FILE_TO_ARMOR_RENDERING"; } public String getTextureFile() { return "FILE_TO_ITEM_TEXTURE"; }
-
So the best way is to check if the generated ore is the coal and then cancel it?I will try to do that but with my Java knowledge it might take a while...Thanks anyway!
-
Because I am quite new to mod developing, I am not quite sure how I can cancel that event.I have found the class but I don't know how I can just cancel the function being called without modifying the existing file...
-
Bump.
-
Hello Forge community, I am a recent modder and I am currently still learning some things about Forge, but I managed to learn enough to start my own mod. The purpose of the mod is to add more types of coal and other items related to the geothermal domain of activity. I have added 4 new types of coal into the game, each with their own ore, but now that there are so many coal ores, I wanted to lower the rate the normal coal spawns, but I don't know how to do that without editing base files. I need help in this situation and I want to know how I can modify certain aspects of ore generation and maybe even modify other aspects of base items/blocks. Thanks.