Jump to content

Nauktis

Members
  • Posts

    23
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new!

Nauktis's Achievements

Tree Puncher

Tree Puncher (2/8)

2

Reputation

  1. Hi, I have a question regarding Containers. Is there a new instance created on the server for each player using the GUI? I am a bit confused as a Container contains a list of players and a list of crafters. I am asking because I want to reduce the number of updates I send to the client by caching values in the Container (on the server) and only send information if something changed. But I don't know if there is a one to one relationship between Container instances and players having the GUI open. Thanks.
  2. Use gradle to fetch everything for you. Add this to your build.gradle (you need to change the versions as they come from a property file for me): dependencies { compile "codechicken:CodeChickenLib:${config.minecraft_version}-${config.codechickenlib_version}:dev" compile "codechicken:CodeChickenCore:${config.minecraft_version}-${config.codechickencore_version}:dev" compile "codechicken:ForgeMultipart:${config.minecraft_version}-${config.forgemultipart_version}:dev" compile "codechicken:NotEnoughItems:${config.minecraft_version}-${config.notenoughitems_version}:dev" }
  3. I found a quick and easy way to do it but I am very curious about the dev version of COFH. They provide so little information on their website for devs... Later I would also like to access the list of existing recipes (to implement my own pulverizer). So if you have information about that as well please post Here's my quick test code (working) try { Class klass = Class.forName("cofh.api.modhelpers.ThermalExpansionHelper"); Method method = klass.getMethod("addPulverizerRecipe", int.class, ItemStack.class, ItemStack.class); method.invoke(null, 150, new ItemStack(Items.apple), new ItemStack(Items.arrow)); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (NoSuchMethodException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } You obviously want to handle the different catch clauses to account for the fact that the recipe was not added.
  4. Hi, I know someone probably asked before but I really could not find the information. I would like to add Thermal Expansion (pulverizer, induction smelter, etc.) recipes for my items. I know the COFH team provides a class ThermalExpansionHelper to do that but I have no idea how to get access to it in my dev environment. Also, I do not want to depend on any mod. If Thermal Expansion is available, I'll add my recipes but if it is not, my mod will just add classic recipes instead. Could you help me a bit or point me to the right direction? Thanks a lot. N.
  5. Alright, thought I would save some space if I managed to find the value without the need to save it in the NBT tag. I'm probably over-engineering the stuff again -.- Thanks for pointing it out
  6. Hi, I am having some issues with my design regarding the way TileEntities are created. As you know, there are basically two ways for a TileEntity to be created. - The Block creates it upon placement using createNewTileEntity(). There we have all the freedom to pass any information we want. - The TileEntity is created (using default constructor) when loading a game that had one already there. My problem is the following: My TileEntity needs some configuration values when it is created (lets say the size of its inventory). I previously stored this value in the NBT tag of the TileEntity and had no problem. But this value is actually configuration and never changes, so I though it is a bit silly that each TileEntity saves it. Before continuing I need to precise that I can not store that config value statically (MyModConfiguration.getConfigValue()) because my TileEntity is used by different blocks that each have a different config value. Lets say I have block1 that has an inventory size of 10 and block2 that has an inventory size of 20. The way to work around this is to ask the block of the TileEntity its config value (worldObj.getBlock(x,y,z).getConfigValue()). My problem is that when a TileEntity is loaded the readFromNBT is called immediately before anything else from the TileEntity is set (world object, position, etc.) My TileEntity is therefore trying to restore the inventory content while the inventory is not yet created because I can not access its size. Would you see a way to work around this? How do you typically handle loading of TileEntities? I hope my explanations are clear enough and thanks a lot beforehand.
  7. Haha! Good to know Works like a charm btw! Thanks a lot for your help
  8. Alright, I'll try it this way then. I didn't try before because the Javadoc is saying: /** * Returns true if automation is allowed to insert the given stack (ignoring stack size) into the given slot. */ Any idea why "(ignoring stack size)"? It is usually used to limit the kind of item you can put in.
  9. Hi, I an trying to limit what can be inserted in an inventory. The kind of limitation I need is: "No more than 10 item Items.apple at any given time." "No more than 8 item Items.arrow at any given time." (all Items.apple do not need to be in the same slot) I am not looking for getInventoryStackLimit() as it will depend on the kind of item. I need the limitation to be applicable for GUI interactions but also machines inserting (hoppers and whatnot). I am currently using a IInventory as sides do not matter but it seems ISidedInventory allows for more control. Worst case scenario, I disallow interactions from machines and use the Slot to have more fine grained control. What do you think? Thanks a lot beforehand for your help
  10. Of course a little gradle clean solved it all. It was probably some leftovers from my different attempts. No more APIs in my jar \o/ Thanks again for taking the time to help me
  11. Well in my case they are in the jar. Doesn't this line tell Gradle to take everything in src/ http://s1.postimg.org/5dusjjl2n/1_src.png[/img] This is the content of my Jar, in my case the cofh api is there. http://s1.postimg.org/gepxokdbj/2_jar.png[/img] And here is the structure of my mod, exactly like you said: Thanks again.
  12. Hi, I've learned a mod isn't supposed to ship the API in its jar file (which of course makes sense). My problem is that by default (unless I missed something), the build.gradle takes everything in src/ How should I configure the build to exclude the api files from the jar? Thanks a lot for your help.
  13. For people finding this topic through Google or Search (like me) Here's the correct settings for the Artifact like TheGreyGhost proposed.
  14. Oh ok, it is that simple I thought the result of this method was only accurate in post-init! Thanks a lot for your help.
  15. Hi, I would like to register different recipes for my items/blocks depending on what mods the user has installed. Simple example, I would have recipes with only vanilla items if the user has nothing but my mod. And I would have recipes that uses items from Thermal Expansion, if they are available. The problem I'm facing is how do I know if Thermal Expansion is installed? Recipes should be registered during the init event. And I'm correct, it is only in the post-init that you can ask if a Mod has been loaded (by its ID) Thanks in advance for your help N.
×
×
  • Create New...

Important Information

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