RANKSHANK
Members-
Posts
305 -
Joined
-
Last visited
Everything posted by RANKSHANK
-
in Item.class there is something like public ItemStack getContainerItemForItemStack(ItemStack i) use this to return what you want
-
How to trigger methods from a class file using Keybinds?
RANKSHANK replied to zildjian97's topic in Modder Support
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 ? -
[1.5.1] Saving Integers in a Config File to Be Loaded Later
RANKSHANK replied to Mitchellbrine's topic in Modder Support
public String registerExtendedProperties(String identifier, IExtendedEntityProperties properties) Grab an isntance of the player and use this to bind your properties to them -
[1.5.1] Saving Integers in a Config File to Be Loaded Later
RANKSHANK replied to Mitchellbrine's topic in Modder Support
Why not use IExtendedEntityProperties? you can directly save it into the player then- -
[1.5.1] Saving Integers in a Config File to Be Loaded Later
RANKSHANK replied to Mitchellbrine's topic in Modder Support
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. -
umm if you bothered to look... ENUMVALUE.toString();
-
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
-
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
-
Hard coding your mod info is easier
-
Hard coding your mod info is easier
-
[SOLVED] Store data with NBTTag within items
RANKSHANK replied to spywhere's topic in Modder Support
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; } -
[SOLVED] Store data with NBTTag within items
RANKSHANK replied to spywhere's topic in Modder Support
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; } -
[SOLVED] Store data with NBTTag within items
RANKSHANK replied to spywhere's topic in Modder Support
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... -
[SOLVED] Store data with NBTTag within items
RANKSHANK replied to spywhere's topic in Modder Support
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... -
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
-
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
-
Modded-Vanilla Bridge on One Server
RANKSHANK replied to MMUntoldAdventures's topic in General Discussion
It's dependent on the modder declaring whether it's content should be required for connection or not... -
Modded-Vanilla Bridge on One Server
RANKSHANK replied to MMUntoldAdventures's topic in General Discussion
It's dependent on the modder declaring whether it's content should be required for connection or not... -
you need to take a look at grabbing accessible instances with reflection
-
you need to take a look at grabbing accessible instances with reflection
-
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
-
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
-
[Fixed] Unregistering of RenderGameOverlayEvent does not work
RANKSHANK replied to Chimaine's topic in Modder Support
just a snippet from my project, probably should have left that out too I'll fix it EDIT: fixed, thanks for that -
[Fixed] Unregistering of RenderGameOverlayEvent does not work
RANKSHANK replied to Chimaine's topic in Modder Support
just a snippet from my project, probably should have left that out too I'll fix it EDIT: fixed, thanks for that -
[SOLVED]Armor, Dye, and Tools Crafting Recipes?
RANKSHANK replied to FloatingGrapefruit's topic in Modder Support
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