Jump to content

BigDaveNz

Members
  • Posts

    39
  • Joined

  • Last visited

Everything posted by BigDaveNz

  1. I was originally self taught Java, now a Software Engineering student nearing degree completion. I originally learnt with The New Boston and Derek Banas, to be honest I learnt how to code, but I wasn't good at it after watching all the tutorials, I struggled through the minecraft source trying to figure things out, as well as trying to learn Java, it was a hard process. I found that trying to understand other peoples code to be the limiting factor. I didn't know anything about the minecraft source, and didn't know where to look for things. Stack overflow is your friend, if you have a problem, google/stack overflow will usually have the answer. TBH the best thing to do is just get experience, start small, and work your way up to what you really want. Trust me, you will write code you think is amazing one day, then 6 months later you will see how horrid it was and change it. The cycle may continue indefinitely. Dont be afraid to try things and experiment. Minecraft Forge IS your Api, the dev environment gradle sets up with setupDecompWorkspace gives you read only access to the minecraft source, fml source, and minecraft forge source. And I do recommend the irc channel #MinecraftForge. Don't go there asking for Java help, but definitely if you want help using MinecraftForge then that's the place to get it. The way to figure out the minecraft code is to look at similar cases to that which you want to do. If you want to create a GUI, look at how the Inventory is opened and use a similar strategy. If you want to create a new block, look at how the vanilla ones are created. Also there are a bunch of open source mods on GitHub, like biomes a plenty etc. go and have a look at what they have done, you might be surprised what you can find out. helpful classes -Timer? = Im sure there is a way to check the current minecraft day. I personally haven't done anything with timers(I think you use IScheduledTickHandler but could be wrong) -Log off? = subscribe to PlayerEvent(in FML) -GUI? = extends GUIScreen -Sky colour? = take a look at the World class(I think) -Touching? = take a look at how Zombies attack Players -Heat Waves? = This is a little bit more complex, although definitely possible, I suggest do everything else first, and coming back to it. TL;DR: -Practice -Use google/StackOverflow -Use #MinecraftForge -Look for opensource minecraft mods
  2. So I stumbled across this post in some random corner of the internet. I want to give whoever coded this a gold star. This is the final form of Minecraft modding. http://codecrap.com/content/400/ Thought I would give you all a laugh for once
  3. The most simple way is: (Note: This is scala code) MinecraftServer.getServer.getConfigurationManager.sendChatMsg(chatComponent)
  4. I doubt theres a complete one yet, I know Wuppy has made alot of headway http://www.wuppy29.com/minecraft/modding-tutorials/forge-modding-1-7/ Keep an eye on that for updates, At this stage I suggest you just do most of it yourself, Or else browse github for opensource 1.7 mod's to see how they have done certain things. If you need a hand with something specific theres always these forums or the #MinecraftForge irc channel
  5. Can you please try to explain that again, In plain english? I can't understand what you are getting at. Forge now uses Gradle to setup dev workspaces etc. There are plenty of tutorials on setting it up in both eclipse and intellij 1.7.2 Forge is out (although It's not finished yet). You are welcome to code for 1.7.2, you just have to work around some obfuscated names.
  6. Seriously? You dont have to do anything with scala... Just open a cmd window and direct it to where you extracted forge Type: gradlew.bat setupDecompWorkspace idea Once complete open the project it creates. Java code goes in src/java Resources go in src/resources And that's about it. I haven't heard of any problems with 1.7.2... If there is I'm sure they can be solved. But If your happy to wait. That's your decision.
  7. One of the easiest way's is to check when a block is broken... or container opened... or player moved... and if it is a certain chunk/coordinate region (depending on which way you want to do it)... If that chunk is in a list of owned chunks and the playuer attempting something in that area is not the owner, you cancel the event and send a message to the player stating that the area is claimed or similar. That's how I do it anyway
  8. You can't store 2 damage values on a weapon. The damage value is 123:1234/ItemID:DamageValue The only way I know of is NBT data. So look up some tutorials on that. Unfortunately it increases the complication by a large amount. But thats what you have to do. As for the rendering, you would have to look into the openGL, create your own custom renderer for the bars , which shouldn't be too hard. Unless you mean add two numbers to the item in the inventory slot. Which is a little bit different. I'm not sure on any of the IC2 specific stuff though.
  9. Sit down with your favourite bottle of whisky... And have a few glasses. while updating, continue this. If you havnt finished the bottle before you finished updating, Your obviously doing something wrong... Start using lang files for everything where possible(if you haven't already). The new chat component system is really simple when you can call everything through the Translate component, and also helps heaps with localizations. I updated to 1.7 a couple of days ago(using the test forge builds) And my small unreleased mod had approx 4000 errors to fix... and about 8 hours work and just over 1000 lines of code changed (Although I changed some things/added new content as well). Almost everything has been modified/tweaked in some way. from chat messages to packets to items/blocks. Most things are small or easy to figure out. For instance Icon is now IIcon... A quick find/replace and you solve 100 or so errors. Some things require a bit more effort. Like chat messages. And some things, such as rendering, I have disabled until the deobfuscation of names is finished, because it is soo hard to guess which boolean out of the 20 is "renderVignette". It's not impossible (and MCP bot does help), but the amount of effort required for each thing seems ridiculous , compared to working on another part of my mod, and waiting for deobfuscation. I feel for the naming team. All in all the update seems to fix a lot of issues... But I'm guessing it will make hundreds more haha.
  10. All chat strings have been moved to IChatComponents. there is still an addChatMessage()... Although it requires a component as the input, rather then a string. I'm currently on holiday at the moment, but I will be back on friday evening. So if you still haven't figured it out by then, I'll test in a 1.7 environment. And see if I can fix it for you.
  11. Pattern Matching, Lambda's and many other features far exceed that of java. Pattern Matching is effectively a Switch/Case statement on steroids... In Java 8 the Switch statement has been improved to allow things like switch with Objects such as strings, rather then just primitives. But it's not as good as scala. Lambda's also are in Java 8, but the problem is, you cant expect everyone to update to a "beta" version of java to use your mod. That leads me to my next point. Everything is done using JVM, there is no language levels etc. Which means you can use all the fancy stuff like pattern matching/lambda's, while still using Java 7, which most users have installed on their PC. Test have show That scala is only 3x slower then C.... Now this is probably not a perfect statistic. But to me that is fairly decent for the type of language it is. It's basically on par with Java, Runtime wise, with writing less code. to look at this more in depth go here http://benchmarksgame.alioth.debian.org/ Its a diverse language, while Java is Object orientated, scala is both Object and Function based. However this is only a good thing if you use it appropriately, Attempt to think in the Scala train of thought, rather then Java, there are heaps of youtube videos on this. Objects/Class separations fixes alot of the confusions people have with the static modifier in java, in my mind it is easier to understand. Although languages such as groovy follow closer too Java syntax, Scala isn't that hard to grasp, It's not like learning an entirely new language. It's clear and simple to understand. Personally for me (as I am currently moving from java to scala). It's like when i moved from Eclipse Kepler to IntelliJ IDEA. I doubt I will ever look back. I do think it will take a month or two for me to fully start to understand scala, but when I do I feel that it's a direction I would like to head. It seems that Scala is improving at a faster rate then java, and you aren't restricted by versions. For instance: We wont be able to use Java 8 functionally for a long time, because the userbase has to update their Java install, whereas as soon as scala updates, you can instantly use the new features in your code, the compiler sorts out the rest. I just recently updated my mod to 1.7 (Thats coded in Java), however I decided to start the conversion to scala (although I'm think an interior mod rework is on the cards at the same time as I convert haha, especially while I wait for deobfuscation/an "Official" 1.7.4 forge version to be released) If you want more information watch this speech (this is the source of most of my information)
  12. ChatMessageComponent is 1.6.4, It no longer Exists, theres now 3 components. Translation, Style, and Text. They all are used together to output a result. Since most functions are Obfuscated, styling is the hard bit at the moment.
  13. First you need to create a class to put all your @SubscribeEvent (1.7) annotations in. Then you subscribe to the appropriate event. Then you initialise your event handler https://github.com/BigDaveNz/EnchantInsanity/blob/master/common/nz/co/bigdavenz/ei/core/handler/EIEventHandler.java That's my event handler. the Key line that you need to know is line 13 My class that processes the events is here: https://github.com/BigDaveNz/EnchantInsanity/blob/master/common/nz/co/bigdavenz/ei/event/EIEvent.java (note this is 1.6.4) As you can see that is the class that is referenced in line 13 of EIEventHandler.java for 1.7 FML now has annotated events. @SubscribeEvent public static void onPlayerLogin(PlayerEvent.PlayerLoggedInEvent event) { //Do stuff }
  14. I'm just updating now. I haven't got a working version yet, simply because of the amount of changes I have to make before I can even run MC. 1.7.2 broke a lot haha. But anyway, You need to Hook into PlayerLoggedInEvent which is in PlayerEvent. Also with chat messages now this is the code for basic, non styled/non translated text. https://gist.github.com/BigDaveNz/8230352 Chatting to a player, command sender and Broadcasting a message to all players is here. (be aware this is untested but "should" work). The EIChatComponent is merely "[EI] " which gets added to all of my chat messages, and is usually styled although I haven't figured out colours/bold etc. for 1.7.2 yet.
  15. Hello all, Decided to try out intelliJ after ~ 1 year of coding in eclipse. Thought Id try it out, weigh up the pro's and cons. Coding wise it seems great, better than eclipse, and It has a decent dark theme. The only thing is, when I run minecraft(even vanilla minecraft), it errors out. Now it must be some tiny schoolboy error somewhere in my dependencies/run configs etc. Because the classNotFound error pops up, although clearly the class is there, in the source. Apparently that classNotFound error is something to do with FML saying "You screwed up bro", and personally I agree with it. New IDE means i've probably made a tiny mistake. Anyway, heres an album of screens showing... The error log, the file structure, run config, Module dependancies(note i removed the EI mod entirely from the dependencies, just hoping to get vanilla running first) http://imgur.com/xYef2pO,ouxhhjr,1kYIojl Also, does anyone know if there is a way to remove errors/warnings from the Forge module? I like to start with a clean slate when it comes to warnings. I did it in eclipse, but don't know how to in intelliJ
  16. Because of how minecraft works, it shrinks down all textures to the correct size ingame, although their resolution remains the same. This means you can get away with replacing any texture, with a higher res one.... EG. Go to a dirt block, replace the dirt's .png with a 256x256 texture. And watch as in game dirt suddenly uses the new texture. Textures can be any size provided their dimensions are divisible by 2
  17. Redpower has been updated in parts by several people. Im sure a little bit of googling would find Project Red. unsure how complete it is, but heres the link http://www.minecraftforum.net/topic/1885652-164forge-multipart-projectred-v41013-11222013/
  18. Yeah, Draco is right, EntityGhast is a great example of a fireball, and for that matter, how the fireball is "fired". Lightning is a little bit harder. You could use create your own custom tile entity based on the EntityLightningBolt class, and creating the tile entity much like a ghast fireball is, except with onItemRightClick() firing the bolt at the targeted entity.
  19. Alright so first of all. What have you got working, the updates have been pretty large (mostly the resource packs). There are some tutorials on the MinecraftForge wiki that will help you out with setting up the resource packs/locations. http://www.minecraftforge.net/wiki/Icons_and_Textures explains the 1.6 way of doing textures. Second. Do you have permission(or is it allowed via the mod's licence) to decompile and work on this mod? If it's closed source there is probably a reason for it, and even if you are using it personally. Although my knowledge is not high enough to suggest things around licences. Third. Depending on how large this mod is, It might be easier to rewrite, while copying/rewriting some of the other code. It's also a great way to clean up code, and understand it, particularly if you didn't write the code in the first place. I know for a fact, Pahimar said that the update to X minecraft version for EE2 was going to take a lot more work the creating EE3 (just as an example). If we knew what mod you were trying to update, we might understand what could've broken.
  20. Thanks for the reply, I'd seen you tutorials when browsing but obviously didn't look at them close enough. My HUD overlay cancels the onRenderGameOverlay event, and draws my hud instead. Therefore I was confused as to whether or not I could use certain vanilla minecraft rendering functions. Or whether I had to code from scratch. But I think with the help of your tutorials and browsing some more vanilla code especially ItemRenderer and RenderItem, I should start to get an understanding of what I need to do. It's midnight so I'll have a look tomorrow. I'll get back to you if I get stuck. Thanks again
  21. Hello all, Recently someone helped me override the vanilla HUD, and its working great, however i got stuck again. I'm recreating the classic vanilla hotbar, except it has quite a few tweaks. Basically, If the item is the current selected item, it renders rotating. Otherwise it renders static. I need help on a couple of things. -How do I decide to render the ItemStack as a item or a block? -How can I render a 3D item (like when an item is dropped ingame) I can render a 3D Block and rotating 3D Block already
  22. As always "When It's done" applies here. It could release tomorrow, or in 5 years time. We don't know, and personally I don't care. All I know is that the Forge/MCP team are doing what they can to release for 1.7. And from what I've heard, 1.7 is not a "bitch" to mod, In the long run, it makes modding easier. It's just the changes are massive, and adjustments take time.
  23. Thanks, I'll try it. EDIT: Works like a charm! thankyou very much. EDIT2: Theres only one issue. when preventing the HUD to draw, it also prevents any GUI elements to be drawn. This means the menu screen, and any GUI's that open wont draw. Is there a way to remove the Vanilla HUD, but keep the Vanilla currentScreen? EDIT3: Fixed it myself. Pretty much, while the custom hud is being drawn if a Vanilla GUI item is opened(inventory/menu etc.). It will cancel the vanilla HUD override and set a boolean to say that a vanilla GUI is open. The the next time currentScreen becomes null; it automatically switches back tot he custom HUD. public void tickEnd(EnumSet<TickType> type, Object... tickData) { if (type.equals(EnumSet.of(TickType.RENDER))) { Minecraft mc = FMLClientHandler.instance().getClient(); EntityPlayer player = mc.thePlayer; if (mc.currentScreen == null && EIHUDHandler.vanillaGUIOpen) { EIHUDHandler.vanillaGUIOpen = false; EIHUDHandler.overrideVanillaHUD = true; } if (mc.currentScreen == null && EIHUDHandler.overrideVanillaHUD && player != null) { EIHUDHandler.drawHUD(mc); } else if (mc.currentScreen != null && EIHUDHandler.overrideVanillaHUD && player != null) { EIHUDHandler.overrideVanillaHUD = false; EIDebugHandler.tempDebugToConsole("resetting hud override"); EIHUDHandler.vanillaGUIOpen = true; } } }
  24. Hello fellow Modders! As the topic suggests, I'm trying to get my head around replacing the vanilla HUD, including any additions that other mods make. The reason is my mod will enough HUD elements that using the Vanilla HUD would get extremely messy. With mod's such as NEI/Thaumcraft/VoxelMap using much of the HUD space, I require temporarily removing these as well as the vanilla bar down the bottom temporarily, replacing it with my HUD elements. Being able to toggle between the two allows me to maintain compatibility with forge mods as well as having a tidy HUD to deal with. GUI/HUD is one part of the minecraft code that I haven't really looked into yet and I really appreciate any help you can give me.
×
×
  • Create New...

Important Information

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