Jump to content

SureShotM

Members
  • Posts

    104
  • Joined

  • Last visited

Everything posted by SureShotM

  1. again Mock Code if I was to actually put this in which i will soon, I would check to see if the NBTtag exists if not then to create it, now the one thing is I don't know how to make the item not be used up when crafted I think that is my initial place to start. I also want to apologize for my scatter brain, this is just how I think and work.
  2. again this was more of a thought, I'm more curious if this would work or not and like I said it was a mock code I don't actually have that code any where so technically there is no where uses is being defined, but I would define like this // I don't fully know where I would put this cause the item will not be crafted but found in a chest stack.setTagCompound(new NBTTagCompound()); stack.stackTagCompound.setInteger("uses", 4); then I would use stack.getTagCompound().getInteger("uses") to define uses
  3. So I am curious on this idea I have. I am thinking of making this item and give it a NBTTagCompound of uses, I would set it to 5 uses, Now what I want to do is when used in crafting it will not consume the item and set the uses to 4(3,2,1,0). Once it hits 0 I want it to then consume the item. Mock code/idea: public boolean hasContainerItem(ItemStack itemStack) { return true; } @Override public ItemStack getContainerItem(ItemStack itemStack) { ItemStack stack = itemStack.copy(); if(uses !=0){ stack.setItemDamage(stack.getItemDamage() - 1); } else { //allow item to be removed } return stack; } now the one thing is I don't know how to make the item not be used up when crafted, and I was debating on using the oncreated() function but read that, that's best to use only for vanilla crafting tables.
  4. Okay Thank you Thank you Thank you it is all working perfectly now.
  5. I just searched through all the possible functions and I did run across the UUID, I was debating on using that but this is just a personal mod for a group of friends, so I will most likely use the username, since they wont change theirs ever. I'm debating on adding the names to a config so if they do decide to change there username they can just add the new one to the config. Again this is more of a debate on all of our ends to figure out what we want. Also Texture is being declared like this. public class ArmorMianite extends ItemArmor { public String textureName; public String Texture; public ArmorMianite(String unlocalizedName, ArmorMaterial material, String textureName, int type) { super(material, 0, type); this.textureName = textureName; setUnlocalizedName(unlocalizedName); this.setTextureName(Reference.MOD_ID + ":" + unlocalizedName); this.setCreativeTab(CreativeTabMianite.Mianite_Tab); this.setMaxStackSize(1); } @Override public String getUnlocalizedName() { return String.format("item.%s%s", Reference.MOD_ID.toLowerCase() + ":", getUnwrappedUnlocalizedName(super.getUnlocalizedName())); } @Override public String getUnlocalizedName(ItemStack itemStack) { return String.format("item.%s%s", Reference.MOD_ID.toLowerCase() + ":", getUnwrappedUnlocalizedName(super.getUnlocalizedName())); } @Override @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister iconRegister) { itemIcon = iconRegister.registerIcon(this.getUnlocalizedName().substring(this.getUnlocalizedName().indexOf(".") + 1)); } protected String getUnwrappedUnlocalizedName(String unlocalizedName) { return unlocalizedName.substring(unlocalizedName.indexOf(".") + 1); } @Override public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) { if ((((EntityPlayer)entity).isInvisible())) { Texture = Reference.MOD_ID + ":textures/armor/" + this.textureName + "_" + (this.armorType == 2 ? "4" : "3") + ".png"; } else { Texture = Reference.MOD_ID + ":textures/armor/" + this.textureName + "_" + (this.armorType == 2 ? "2" : "1") + ".png"; } return Texture; } Also if we decide to use the username how do I get the username instead of the display name, I am currently using the if player is invisible as a place holder.
  6. So I want to have it where I check to see if a player is wearing a custom armor and if they are the armor uses a different texture then for all other players. I tried this: @Override public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) { if ((((EntityPlayer)entity).getDisplayName() == "SureShotM")) { Texture = Reference.MOD_ID + ":textures/armor/" + this.textureName + "_" + (this.armorType == 2 ? "4" : "3") + ".png"; } else { Texture = Reference.MOD_ID + ":textures/armor/" + this.textureName + "_" + (this.armorType == 2 ? "2" : "1") + ".png"; } return Texture; } but it doesn't seem to work
  7. Works like a charm now, Thanks for all the help.
  8. I already fixed that thank you though. Note if there's a better way I can do what I'm trying to do then it would be nice for any suggestions really. I am seriously having stupid moment here but my brain is not registering anything with this code.
  9. Okay maybe I should just stop trying cause I'm still having coders block, I understand what you are saying that its local, and its only righting to it the one time but even when I try to make another class for it, or unlocalize it, It still isn't changing when player sneak right clicks. Actually now its not doing anything at all.
  10. So I am working on this little bit of code where if player sneaks right click with the item it will change modes and display message on witch mode it is on, it sorta works but it doesn't really switch modes. Can someone tell me what I am doing wrong or point out what I am not realizing. Code: @Override public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) { int Mode = 0; if(Sides.logical(world).isClient()) { if(((EntityPlayer) player).isSneaking()) { if (Mode == 0) { ((EntityPlayer) player).addChatComponentMessage(new ChatComponentText("Info Mode")); Mode = 1; } else if (Mode == 1){ ((EntityPlayer) player).addChatComponentMessage(new ChatComponentText("Processing Mode")); Mode = 0; } } } return stack; }
  11. So I was thinking about this and got curious about the idea and wanted to see if it was possible. My thought was to add a function to my mod that uses tinkers construct, I know I will need the api, but here is the first thing I have know clue where I would put the api, second I was wondering if it was possible to not require tinkers to use my mod. Code example: I know this isn't the actual code its just for explanations. if(mod tinkers construct is installed(runing along side)) { //create a fluid //create smeltery process //create tcon items with my metal } again this was just a though if it is possible I will mostly add it when I get further in till then this wont be implemented.
  12. Ok Got it working with the static init, but the interesting thing is I tried doing it without the static init and it still didn't work and threw the same null pointer, but I think it was because that the block wasn't connecting with the fluid id, so I added this to my Fluid Block class and it works now. Fluids.HydrofluoricAcid.setBlock(this) The code above goes into the constructor. Also I would like to thank you for your help it did lead me to this solution, The other thing I would like to note is that the static init isn't ugly code in my opinion cause then you can register/initialize multiple blocks, again its all about the coders style and opinion though.
  13. Well a few things now one I was looking at a mod that has fluid in them and found what looks like how they are doing it, so Ill give that a shot if that fails then I will just switch over, if any new errors come up I'll mention them but for now back to the trials and errors of coding.
  14. okay I'll see what changing it will do for me, but i would like to note that I am not saying Pahimar is oh-so-fancy, but when you have the knowledge to look at other sources(open source mods) and look at there structure, it seams like it is more common then not to see a static init load blocks, and items(not sure about recipes or fluids). I do appreciate the help though, I'm just sorta curious if there is a way to do this with the static init since it does seem to keep things organized and less cluttered. If the only way to fix this problem is by loading it through the preinit then so be it. Note what I mean by open source mods I specifically mean well known mods.
  15. Okay I'm confused a bit here then, All blocks or just Fluid Blocks?, only reason why I ask that is cause if you look at pahimar's tutorial or most tutorials at that they create a static init and load it to the preinit, For my example in my case I have an ore that is in the ModBlocks.init(); witch I am calling from the preinit, I am doing same for my fluid block. I guess again I'm just confused.
  16. Sorry was in process of revisions, It keeps throwing a null pointer error, i posted the error log.
  17. So I am trying to make my own fluid, I have looked at and tried a few solutions to no avail. I have made sure that I am registering the fluid first then the block after, and to even make sure i directly the registering code into my preinit and that didn't work. I cant seem to find what I am doing wrong, I have a feeling I'm missing a line of code somewhere cause I've caught my self doing that sometimes recently. Either Way it keeps throwing a null error and I don't know why. preinit code: Fluid Class code: Fluid Block code: Fluid Registry Code: Fluid Block Registry: Error Log:
  18. Ok thank you for this, I'm sorta curious why Intellij 14 has this since in previous versions it worked fine but o well its working now thank you.
  19. I realized after I posted that I forget some of that information and I apologize its been one of those days, back to the topic though, I use intellij and on occasion I use eclipse, I don't have any textures yet but the lang files do work(the only one I have is the en_US.lang). I put the mcmod.info file into the resources folder(src/main/resources), now I did read some where that this location for it has changed but it didn't mention where. I would also like to note that I thought I created the file wrong but I don't think that is the case now
  20. Ok so I have tried multiple things to get the mcmod.info to work but every time I load it to see if it works and it keeps telling me that I need to ask the mod author for a mcmod.info file, So i made sure the modid was the same in all my files and it is. So here is the mcmod.info file. { "modListVersion": 2, "modList": [{ "modid": "testmod", "name": "Tes Mod", "description": "Leo's Mod for testing ", "version": "1.0.0", "mcversion": "1.7.10", "url": "", "updateUrl": "", "authorList": [ "Leo" ], "credits": "Authored by leo", "logoFile": "", "screenshots": [], "parent": "", "requiredMods": [ "Forge" ], "dependencies": [], "dependants": [], "useDependencyInformation": false }] }
  21. So far I have finished what MineMaarten has on his youtube and that's exactly what I needed so now I'm going to start my own project and see where it leads, on the other hand I still want to see what others may suggest, especially since 1.8 is starting to become a thing.
  22. That is quit ironic actually I just went to my youtube not to long ago and in my suggested to watch that showed up I'm taking a look at it now, thank though so far it seems to be exactly what I need.
  23. So this might sound stupid but and maybe it will be better if I sorta explain my self. First off I have programed in java and have java knowledge and when I went to just create a mess around mod for fun I just did it with that knowledge and I did fine but was confused on a few things, So I've been looking for tutorials for the 1.7.10 forge but cant seem to find any that either go over it in detail or that are not complete. For example I tried going threw wuppy's tutorials but got lost, I also tried Pahimar's tutorials and I understood it and could retain the information but it stops at key bindings, and any of the text tutorials I find aren't for 1.7.x so can anyone give me a link to one they think might be useful to me. On the other note does anyone have any suggestions where I should start my modding experience, what I mean by this is should I start my own or should I make an add-on mod to a mod like tinkers construct or thaumcraft.
  24. Thank you so much you've cleared up my confusion and now understand why I couldn't find the damageItem(), I was trying to run it as hitEntity.damageItem() not stack.damageItem(1, hitEntity). Thank you thank you.
×
×
  • Create New...

Important Information

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