Jump to content

RANKSHANK

Members
  • Posts

    305
  • Joined

  • Last visited

Everything posted by RANKSHANK

  1. in Item.class there is something like public ItemStack getContainerItemForItemStack(ItemStack i) use this to return what you want
  2. boolean[] keyBindRepeatFlag = { (boolean)false }; WAT Aside from that, you're going to need an Object instance not a class instance to do something like that, as in how are you getting your EntityHellHound hound ?
  3. public String registerExtendedProperties(String identifier, IExtendedEntityProperties properties) Grab an isntance of the player and use this to bind your properties to them
  4. Why not use IExtendedEntityProperties? you can directly save it into the player then-
  5. well theres a variety of ways, you could store in a NBTTagCompound and then use CompressedStreamTools.writeCompressed(NBTTagCompound, OutPutStream); you'd have to set up the output stream public void write(NBTTagCompound yourData, String loc) throws Exception; File f = new File(loc + "filename.dat"); if(!f.exists() &&(!f.mkdirs() | !f.createNewFile())) throw new Exception("Failed to write @" + f.getAbsolutePath()); FileOutputStream out = new FileOuputStream(f); CompressedStreamTools.writeCompressed(yourData, out); out.close(); //ALWAYS ALWAYS ALWAYS CLOSE YOUR STREAMS WHEN THEY ARE OPEN or if you want a modifiable value in a text file you can use a BufferedWriter BufferedWriter b = new BufferedWriter(new FileWriter(File yourFile))); b.close();//ALWAYS or you could always use the plain file output stream FileOutputStream out = new FileOutputStream(File yourFile); out.write(ByteBuffer.wrap(new byte[0]).putInt(yourVal).array()); out.close();//AGAIN and theres many more methods of writing you can find. it depends on what you want. you could even go heavy on the sauce and implement Serializable and writing your whole class, of course delegating transient values- though that's a tad overkill here.
  6. umm if you bothered to look... ENUMVALUE.toString();
  7. Nope you don't need a MC .modinfo file you have to set autogenerated to false. I use: @PreInit public void randomName(FMLPreInitializationEvent event){ ModMetadata m = event.getModMetadata(); m.autogenerated = false; m.modid = ID; m.version = VERSION; m.name = NAME; m.description = description; m.authorList.add(authorNam);} and it works. for multiple mods in the same workspace /horray
  8. Nope you don't need a MC .modinfo file you have to set autogenerated to false. I use: @PreInit public void randomName(FMLPreInitializationEvent event){ ModMetadata m = event.getModMetadata(); m.autogenerated = false; m.modid = ID; m.version = VERSION; m.name = NAME; m.description = description; m.authorList.add(authorNam);} and it works. for multiple mods in the same workspace /horray
  9. Hard coding your mod info is easier
  10. Hard coding your mod info is easier
  11. If you need to set the value, look at GuiScreenBook, if the value is set by opening the Gui its done by sending the changed value. Alternatively, if you are setting the value server side, you could simply do so in your IGuiHandler like so: Random rand = new Random(); @Override public Object getServerGuiElement(int ID, EntityPlayer p, World w, int x, int y, int z) { if(ID == yourGuiID && p.getCurrentEquippedItem == yourItem){ ItemStack i = p.getCurrentEquippedItem(); if(!i.hasTagCompound()); i.setTagCompound(new NBTTagCompound); i.getTagCompound().setInteger("randVal", rand.nextInt(intYourRange); //or use your wrapper here } return null; }
  12. If you need to set the value, look at GuiScreenBook, if the value is set by opening the Gui its done by sending the changed value. Alternatively, if you are setting the value server side, you could simply do so in your IGuiHandler like so: Random rand = new Random(); @Override public Object getServerGuiElement(int ID, EntityPlayer p, World w, int x, int y, int z) { if(ID == yourGuiID && p.getCurrentEquippedItem == yourItem){ ItemStack i = p.getCurrentEquippedItem(); if(!i.hasTagCompound()); i.setTagCompound(new NBTTagCompound); i.getTagCompound().setInteger("randVal", rand.nextInt(intYourRange); //or use your wrapper here } return null; }
  13. if(world.isRemote){ so you don't want your data stored...? if it's not done serverside, the item will have its data reset... unless you have [/code]@Override public boolean shareTag(ItemStack i){ //something like this, double check the method name return false; }[/code] to prevent the server from sending an overwriting nbt packet, but whatever data you store WILL be lost when the itemstack is offloaded in any way...
  14. if(world.isRemote){ so you don't want your data stored...? if it's not done serverside, the item will have its data reset... unless you have [/code]@Override public boolean shareTag(ItemStack i){ //something like this, double check the method name return false; }[/code] to prevent the server from sending an overwriting nbt packet, but whatever data you store WILL be lost when the itemstack is offloaded in any way...
  15. use the forge tutorials on the wiki Knife.iconIndex = ModLoader.addOverride("/gui/items.png", "/item/sword.png"); Minecraft builds its own textures now, that's dead code, also, icon setting is handled in the ItemClass in a @SideOnly(Side.CLIENT);- so keep it there and that will be SMP safe
  16. use the forge tutorials on the wiki Knife.iconIndex = ModLoader.addOverride("/gui/items.png", "/item/sword.png"); Minecraft builds its own textures now, that's dead code, also, icon setting is handled in the ItemClass in a @SideOnly(Side.CLIENT);- so keep it there and that will be SMP safe
  17. It's dependent on the modder declaring whether it's content should be required for connection or not...
  18. It's dependent on the modder declaring whether it's content should be required for connection or not...
  19. you need to take a look at grabbing accessible instances with reflection
  20. you need to take a look at grabbing accessible instances with reflection
  21. Well you'd need to send the new spawner entity ID and the minecart's ID and then when recieved grab that minecart with its ID and pseudo load it, there's a few good packet tutorials on the wiki, start with the simpler one here: http://www.minecraftforge.net/wiki/Packet_Handling ps: ALWAYS CLOSE THE STREAM
  22. Well you'd need to send the new spawner entity ID and the minecart's ID and then when recieved grab that minecart with its ID and pseudo load it, there's a few good packet tutorials on the wiki, start with the simpler one here: http://www.minecraftforge.net/wiki/Packet_Handling ps: ALWAYS CLOSE THE STREAM
  23. just a snippet from my project, probably should have left that out too I'll fix it EDIT: fixed, thanks for that
  24. just a snippet from my project, probably should have left that out too I'll fix it EDIT: fixed, thanks for that
  25. GameRegistry.addRecipe(new ItemStack(baconiteChestplate), new Object[] { "T T", "TTT", "TTT", 'T', Crystalia.baconiteIngot, }); //tools baconiteBow = new BaconiteBow(5010).setUnlocalizedName("Crystalia:baconiteBow"); LanguageRegistry.addName(baconiteBow, "Baconite Bow"); here you are registering recipes before creating the item, which is a no. this registers a null instead of the item, since the item is set to null until you have placed an instance in it
×
×
  • Create New...

Important Information

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