Jump to content

Netglex

Members
  • Posts

    13
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed

Netglex's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. @Failender: It was a success with setTagCompound and getTagCompound . I never used it before, but with the help of some tutorials it works now. Thanks! I used itemStack.stackSize == 0 , because if the health of this item is equal zero, you strangely still have the item in the inventory with stacksize == 0 as you can see in the image. Server and Client share the same class. @Draco18s: It is as Failender mentioned in his last post. Sorry for this unclear explanation. For all other people with similar problems: Here is the solution. // make it possible to add additional attributes itemStack.setTagCompound(new NBTTagCompound()); // add an additional attribute to the item with tag "isLoaded" and value false itemStack.getTagCompound().setBoolean("isLoaded", false); // get the additional attribute with tag "isLoaded" boolean test = itemStack.getTagCompound().getBoolean("isLoaded") Usually the first and second line of code should be called in the onCreate method (or in my case in addInformation , because I already need the additional attributes in this method). And for the third line: use it, where you need it in you mod.
  2. I have the following method in one of my item -class. It is a musket, which has a boolean value isLoaded (globally defined) which determines if the weapon is loaded (true) or not (false). Because this method is called once from client and once from server, the following thing happen: Firstly, isLoaded is false . Now if you go let off your right mouse click, in the first go, isLoaded is set to true . In the second go, the method shootEntity(world, entityPlayer) will be called, means you shoot. But I don't want that. I want to right click for reloading. The second time you right click you should shoot. Is there a way how I can change my code? Or is there a better way to add a new attribute to an item in Minecraft Forge? @Override public void onPlayerStoppedUsing(ItemStack itemStack, World world, EntityPlayer entityPlayer, int timeLeft) { if (isLoaded) { if (!entityPlayer.capabilities.isCreativeMode && entityPlayer.inventory.hasItem(MatchmusketItem.cartridge)) { itemStack.damageItem(1, entityPlayer); if (itemStack.stackSize == 0) entityPlayer.destroyCurrentEquippedItem(); entityPlayer.inventory.consumeInventoryItem(MatchmusketItem.cartridge); } shootEntity(world, entityPlayer); isLoaded = false; } else if (entityPlayer.getItemInUseDuration() >= 20.0F) isLoaded = true; }
  3. Thank you guys for your help. I could find there some SRG names, but unfortunately not all (maybe I didn't look close enough?). I found another file where I could get the SRG names of potionRequirements and potionAmplifiers : It's where you placed your Minecraft Forge src. There, go to build build/tmp/reobf. I think, after you used the command gradlew build , you will find there a file called reobf-default79498240393083092.srg or sth similiar (number can be different). There you will find some SRG names (including potionRequirements and potionAmplifiers ). Just in case, if someone is too lazy to look it up : potionRequirements = field_179539_o potionAmplifiers = field_179540_p Important: This SRG names are for Minecraft Forge 1.8!
  4. I'm updating a mod, but I can't find the SRG names for potionRequirements and potionAmplifiers . These are Map objects in the class PotionHelper (package: net.minecraft.potion ). I usually look up this stuff in the conf/field.csv file from mcp. But since mcp910 I can't find it there anymore. Is there another way to find out the SRG field name of this two Map objects? Thank you in advance.
  5. It depends, in what way the blocks are different. If all these are just normal block with just another texture, footstepsound, id and name, than you can create just one new class. If one block should have a special property, then you should do a new class file especially for this block. Well basically, this is a classfile of a normal block: package Tutorial; import net.minecraft.block.Block; import net.minecraft.block.material.Material; public class TutorialBlock extends Block { public TutorialBlock(int par1, int par2, Material par3Material) { super(par1, par2, par3Material); } @Override public String getTextureFile() { return "/Tutorial/tutorial_texutre.png"; } } In your mainmodfile, you should write something like this: public static Block tutorialBlock= new TutorialBlock(500, 0, Material.sand).setHardness(3.0F).setResistance(5.0F).setStepSound(Block.soundStoneFootstep).setBlockName("oreCopper");
  6. You have to have look at "modid", "name" and "version". They have to be the same like in your own mod. [{ "modid": "Tutorial", "name": "Netglex", "version": "1.0", "url": "", "credits": "", "authors": [ "Netglex" ], "description": "This is a test file.", "logoFile": "", "updateUrl": "", "parent":"", "screenshots": [] }]
  7. Thanks so far, but I can't use par1ItemStack.Id. Id is simply not available. And sorry, if I was unprecise: This is the right code: without this.isFull (this.isFull was copied from a bucket and this.isFull means the bucket's content): @Override public boolean itemInteractionForEntity(ItemStack par1ItemStack, EntityLiving par2EntityLiving) { if (par2EntityLiving instanceof EntityOcelot { par1ItemStack.itemID =Tutorial.itemID+256; } return true; } But anyway: How do I solve this problem now? And what does the return-value mean?
  8. Hello together. I have the following question: How do I use itemInteractionForEntity(ItemStack par1ItemStack, EntityLiving par2EntityLiving)? There were two arguments: Objects of ItemStack and EntitiyLiving. Now I want to get a certain item, if I click on an animal. This looks like this: @Override public boolean itemInteractionForEntity(ItemStack par1ItemStack, EntityLiving par2EntityLiving) { if (this.isFull == 0 && par2EntityLiving instanceof EntityOcelot { par1ItemStack = new ItemStack(Tutorial.FishBone); } return true; } But obviously the item won't change. I've already tried with itemID, itemID+256, itemID-256, but all these didn't work. What do I have to improve? And what is the return-value standing for?
  9. I have the following problem: I programmed a custom bucket: the golden bucket (for example). Now, I want to milk a cow with it. I've already seen, that in ItemBucket.java, there is the important part: However, I recognized that in the file EntityCow.java, there is another important method: This is probably also responsable for the milking process. My question is now: How can I milk with a golden bucket without changing EntityCow.java and just changing my own mod files?
  10. Thank you really much for your help. I had again a look on my subclass and I found the mistake. It was really tricky in a way... But afterwards it sounds really easily. My mistake was: You shouldn't forget this.isFull = par 2 in public TutorialItemBucket(int par1, int par2). Hint: With this code, you have a bucket which can take just water and nothing else. Thank you gcewing!!!
  11. At the moment, I'm learning to develop mods for Minecraft 1.4.7. However, as you can see in the title, I don't know how to programm a custom bucket. For example if I want to programm a gold bucket. Is there a special implentation available in Minecraft Forge? I heard of IBucketHandler, but it seems, that this doesn't exist anymore. Is there another way to programm it? Should I simply make the gold bucket a subclass of ItemBucket.java and change some values of its methods? If this is the right way, how should I do this exactly, because I already tried this, but it didn't work (maybe it's just a stupid mistake I haven't seen yet). Thank you for helping!
×
×
  • Create New...

Important Information

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