Jump to content

pickaxe_engineer

Members
  • Posts

    66
  • Joined

  • Last visited

Everything posted by pickaxe_engineer

  1. 1. Why do you post code with *obvious* compilation error(s)? 2. Why do you call super ? You are not using it. 3. Why do you not use the random number? So the answer is *no*. I'd highly suggest to first learn java or at least how object oriented programming works. Then come back and learn forge. Sincerely -pick
  2. Within 2 seconds, going from Block via CTRL+F to emerald ore, to the BlockOre class of minecraft I found this: MathHelper.getRandomIntegerInRange(rand, 3, 7); which is used to determine how much EXP is generated by mining emerald ore. Sincerely -pick
  3. Hi I am tinkering around with custom entity attributes (I know I have to use the new forge caps) upon breeding animals. My strategy was to find out on how to determine an entity is a newly spawned child, created by breeding (since baby-animals may also spawn in creative mode differently). The problem is: I did not find a dedicated event for this, so I thought I have to use LivingEvent.EntityConstructing, which I registered successfully. This is the code for my event handler: The issue is now, that I got the feeling that this event is not fired during spawing the baby-animal. I'm using forge version 12.16.1.1887 and looking forward to get some hints on how to solve this. Sincerely -pick PS: The overall goal of my attempt is to check upon birth if the parents (nearest two adult animals, I guess) do have some attributes (capabilities) and apply these to the child.
  4. Hey guys Recently Bedrock_Miner asked a similar question: http://www.minecraftforge.net/forum/index.php?topic=26383.0 I found the location of the log4j config file too, but this is read-only in the forge.jar. I hope someone out there knows a solution. Sincerely -pick
  5. Hi I don't know bucket very well, since I mostly played alone. You need: - define some actions: (place, break, interact) with block, - manage some registry where you can read and modify such permissions, based on the player, the location (x,y,z) and the action - change the block to a TE - register listeners for the above mentioned actions (is there a forge event for activating a block?) Since I am a forge newbie, but I do know programming, I sugestthe best way would be to learn more about java. I'm not sure whether to go with a tree or a table for said registry. Also I have absolutely no plan about identifying the player (UUID I guess?). I hope this reply was understandable for you and may pushes you in the aiming direction. Sincerely -pick
  6. Hi Draco18s Thank you for your reply. Unfortunately this does not help solving the mentioned issue. The item is still displayed, after consumption and it still displays the decreased stackSize correctly when putting more than one fuel item into it. I guess the problem is somewhere in my updateEntity method, which I changed slightly. Sincerely -pick New TileEntityGenerator.updateEntity() method:
  7. Hi XenoMustache Since you did not post any code of yours, it's hard to guess what went wrong. I'd just mention (what you probalby read a lot) that you may set the harvest level in the constructor of your block extending class. Or right after the initialization of your block object. For convience and easy-to-use minecraft often returns the object when setting something, so you can call the constructor and 'chain' a lot of settings (see the register... method in net.minecraft.block.Block). Now for you error: This seems like you do this chaining and for unkown reasons the method you are calling does _not_ return the block object. May my reply was helpful Sincerely -pick
  8. G'Day everyone I do have a little strange issue: Whenever I insert a single item into my generator (like coal), the item is consumed but client-side still displayed (consumed = tested with some logging that the itemstack which represents the said slot is null). Closing and re-open the GUI or just clicking on the item removes it from the GUI. Since I've just started with modding I'm very confused. Especially since I thought I did understood the vanilla furnace updateEntity method and adapted it for my purposes. I learned from the vanilla code and made my own furnace (in this custom furnace it works with a single fuel item too) and added a few methods, suggested by wuppy's mod dev book (I'm talking about the TileEntityGenerator.onDataPacket() and the TileEntityGenerator.getDescriptionPacket() methods) But still I did not understood everything, so please don't blame me, TileEntityGenerator.decrStackSize(int, int) and ContainerGenerator.transferStackInSlot(EntityPlayer, int) are mostly copied from the vanilla furnace and slightly renamed the variables. Thus I do have this questions: - Does anyone see why the above mentioned 'ghost item' thingy happens? The funny part is, that if I put two items into the slot, the stacksize gets immediately decreased by one (as expected). Thank you in advance and feel free to criticize my coding, as mentioned before, I'm a forge newbie. Sincerely -pick Appending the code: TileEntityGenerator.java: GUIGenerator.java: ContainerGenerator.java EDIT: Corrected the closing spoiler tags
  9. Hi I assume your issue is that you marked the method to clientside only. Read this: http://www.minecraftforge.net/forum/index.php/topic,22764.0.html Sincerely -pick
  10. Hi From my point of view, I wonder why you check the condition twice. Is there any reason for this? By the way, I'd suggest to not use the event system. I'd rather code that test in the Hammer itself. Get the drops of the block there and don't spawn them. May my reply was helpful Sincerely -pick
  11. Dear Electrobob99 I spend another few moments on your problem and since since other modders could be interested as well, I'd like to share my code with you. Although I versioned the files with version 1.0, I guess these mechanique could be improved alot. Read the javadoc breifly and you should understand what I've done. Please keep in mind, that I wrote this quickly and did only made the following tests: I used the _InWorldCrafter_ item to test the manager and recipes, in this item I also added the recipes - that's not how to use it in a real environment! The given recipes are processed correctly and beyond that I don't know (as often in programming: 'it should work...'). I'm absolutely not keen on fame but if any of you take these lines, please leave a notice from where this code comes from. The recipe class: The manager class:
  12. Hi Well, the point is that you don't check if there ARE items or not. It's written so, that if no recipe was found (which is the case if no ingredients are available), the recipe is null. If you try to craft the result of null, it will throw a NullPointerException. Be patient, I think I can come up with another solution shortly. Sincerely -pick
  13. Hello Do you use this logger: event.getModLog(); //event is preInit event Because for this one, the javadoc sais: The point that I dont get, is which config folder do I have to use? The one that is child of eclipse/ ? Then again, log4j 2 tells us to use either a JSON, XML or YAML file - why forge wants us to use a properties file? Sincerely -pick
  14. G'Day CreativeTabs its a good point: As of my understanding you cannot expect an item / block in a creative tab without set the creativetab (Weird sentence, sorry, you need to call 'setCreativeTab' somewhere arount registering). Again: Do you call the ItemsMO.init() function? Sincerely -pick
  15. Hi May it's a silly question, but do you really call the init() method ? And since you do have two classes, one for accessing and one for registering the item object, are you sure you got those references correctly? Sincerely -pick
  16. Hello again Well, what I've tried to say is, that you need your creativity to answer this question. Or another developer. It's slightly difficult to explain this process of 'having an idea and get into code'. I personally absolutely don't like pseudo-code, I'd rather work with some sequenz diagrams or mostly better with a mix of UML class diagrams, 'ability list' and some sort of crazy sketches of the object's behaviour that no-one but me can read. I cannot tell you more about this than I've done yet. Learn more Java or break down your goal into smaller pieces and achieve them step by step. I don't support copy-paste replies on questions, but this time I've made an exception, I guess. Since I replied a lot in this thread I made some further thoughts on the given problem. In the next spoilers I will post some code that I made but please keep in mind: - This code is anything but near completion - It's made quickly and not tested into depth - Not able of the desired 'craft as many times as possible' - Very basic - Do whatever you want with it May it helps you. I haven't commented much, so feel free to ask if something is not 'self-explaining'. First the recipe class Secondly the manager class: And lastly an example-testing item: May you got me this time... Sincerely -pick
  17. Hi yes, so true. Since I am still a newbie too, I don't know if I am right, but I currently use GameRegistry.addShapelessRecipe(ItemStack, Object... args) Where the itemStack the result is (metadata and quantity set) and the args-object is a so-called variable argument list, containing ItemStacks of ingredients (again, metadata and quantity sensitive). But all this code is at least for 1.7.10 and I do absolutely know nothing about 1.8... Hope this was helpful Sincerely -pick PS: http://www.wuppy29.com/minecraft/modding-tutorials/wuppys-minecraft-forge-modding-tutorials-for-1-7-creating-your-own-mod-standard-setup/#sthash.cinJYSQ8.dpbs - A link to some really good beginners tutorials, they helped me a lot.
  18. G Day Excuse me, worldgen = WorldGenerator class, the class you are talking about. Well, each the block class delivers some methods you could overwrite. One of them is _canPlaceBlockOn(Block test)_. So far I can tell you, there are two ways to define 'it must be grass underneath': while the world is being decorated (within your WorldGenerator) or within the block class itself (by above mentioned method). Did you try the suggested code in my previous reply? To push you a little bit more into the assumed 'correct' direction: Remember: Don't just copy-paste the example! Hope this time I was more precise Sincerely -pick
  19. Hi I'd like to mention first, that it is _java convention_ to name variable in camelCase. Look at the point were you get your y-coordinate. Is it normal to randomly pick the height? Wouldn't it be better to get the 'surface' block there? Thus try the following: world.setBlock(x, world.getTopSolidBlock(x,z)+1, z, /*yourblock*/, /*your meta*/, /*flag*/ ); //for the flag see: world.setBlock(int,int,int,Block,int,int); Some other questions are: - Is your worldgen correctly registered? - Does your bush check if it can sustain For the future: some System.out.println(msg) mostly help to see what is happening... I hope my reply was helpful Sincerely -pick
  20. Dear Electrobob99 I'd like to help and I am still a newbie in forge, but I do code in java for a longer time now. The said 'CraftingManager' that I mentioned previously is what you have to come up with. From my point of view, the vanilla craftingmanager doesn't fit to the requirements. More than this, I think this is the part where your creativity gets involved: Having an idea and convert it to actual code is not teachable. I'd suggest to write down (on good old paper) what you need and then construct your classes. May there is already something out there, that fits in what you are looking for. To still give some reply on your last question: Firstly you need an abstraction of such an recipe: Store the tuple ingredient/amount/result in it and may some other information. As a next step, I'd suggest to code some sort of CraftingManager that is capable of holding such recipes. It should also have some power, meaning that it's able to sort these recipes (Comperable recipes or a Comperator). Since this is not my project, I don't know wheter I covered all the points... May this post was helpful, but I'd really recommed in tinkering around or get another person on board. Sincerely -pick
  21. G'Day It looks like I see why you're so confused. Metadata is a number that a block can have, as an attribute. The best known example is wool: the color is a 'visual representation' of that metadata (from the coding view it's vice versa). You should calculate or _return_ the harvest level more or less the same why like you did it with the IIcons. -> EDIT: As diesieben07 previously mentioned: _return_ is the keyword you are looking for. But to be honestly, it looks like you really recently started modding and I'd really suggest to go to google and read through / look some tutorials. Sincerely -pick
  22. G'Day No I'd rather check the metadata, since this is surely passed to the method. Use somewhere mostly defined an array of IIcons or something, where you decode the metadata into the corresponding IIcon, right? Do the same in here: depending on the metadata return a different harvestlevel. I hope this brought you to the right direction. Sincerely -pick
  23. G'Day Wow, that's a weird sentence. Let's check if I got you right: - You want to remove the 'consumed' amount from a ItemStack - You'd like to craft the result several times, if enough items are provided? If that is _not_ your target, I suggest to rewrite your question. Otherwise: Your code is a kind of strict and mercyless, isn't it? You check for the desired item and if it is, you just remove the complete EntityItem, regardless to stackSize or anything else. If I had to do something like your target, I'd create my own recipes class and code a manager for those recipes. This manager may receives an ArrayList of EntityItems and all the magic would happen there. It would be responsible for only taking the desired amount of items, the spawning of the new one etc The point you missed in your previous code example is, that you need to check the _stackSize_ of the ItemStack. Something like: The above code would go into said manager or into the iteration through the list of EntityItems. I haven't covered yet that you also want to check several items. I would have for each amount / item tuple a boolean flag. Instead of crafting the result during the iteration, I'd then check _after_ the iteration if all the flags are true. I hope this reply is helpful (sorry, it's kinda long) Sincerely -pick
  24. Hi Did you test my previous advice? The crash-report really looks like the above mentioned problem occured. If it helps: Sincerely -pick PS: Why didn't you post your new code?
  25. Hi Since I'm a newbie, forgive if I don't know everything correctly. What I'v learned so far, you need to do something like the following: 1. Get the EntityItem within a certain radius (MrCaracal gave you the ingredients) 2. Iterate through the result to check if a) the item's are correct b) the amount of each item is correct. I mostly learn forge through examples, so here is one: I hope that was helpful Sincerely -pick PS: It really IS helpful to post the 'not working' code...
×
×
  • Create New...

Important Information

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