Posted January 7, 20187 yr Hey! I keep taking glances at the Referenced Libraries and the code in them and they have a style that I personally adapted, but I just space everything out myself when coding. I was wondering if there is any way to have line breaks between the beginning and end of block codes. For instance: /* Event fired when an entity dies */ @SubscribeEvent(priority = EventPriority.HIGHEST) public void onLivingDeath(LivingDeathEvent event) { if (event.getEntityLiving() instanceof EntityLiving) { EntityLiving entity = (EntityLiving) event.getEntityLiving(); entity.playSound(SoundEvents.BLOCK_METAL_BREAK, 1.0F, 1.0F); for (int i = 0; i < 50; ++i) //line break above { entity.worldObj.spawnParticle(EnumParticleTypes.BLOCK_CRACK, entity.posX, entity.posY + (entity.height - 0.25D), entity.posZ, Math.random() * 0.2D - 0.1D, Math.random() * 0.25D, Math.random() * 0.2D - 0.1D, Block.getIdFromBlock(Blocks.REDSTONE_BLOCK) ); }//line break below if (...) { ... } try { } catch(...) { ... } } } I've been trying to accomplish this for a lot of time, yet no success. Any ideas? Thanks! Edited January 7, 20187 yr by Differentiation
January 7, 20187 yr I don't think that's something that can be controlled by automatic code formatting. :\ Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
January 7, 20187 yr Author 3 minutes ago, Draco18s said: I don't think that's something that can be controlled by automatic code formatting. :\ aw, that's a bummer, is there any other way to format it this way other than doing it manually? It's a pain Edited January 7, 20187 yr by Differentiation
January 7, 20187 yr Author 1 hour ago, diesieben07 said: IntelliJ's Code Style settings offer a vast amount of options, which should get you at least close to what you want. Ah! I knew it, it's about time for me to switch to a more professional software... thanks for the help!
January 7, 20187 yr Both Eclipse and IntelliJ can do a lot of automatic formatting. If modders want the formatter XML template file that does all the indenting and braces and stuff they can get it from the ForgeEssentials github project here: https://github.com/ForgeEssentials/ForgeEssentials/tree/develop/misc Now the formmater doesn't cover the specific question for this thread about blank lines after a for loop. But that can be set in Window/Preferences/Java/Editor/Template settings. Just add a blank line at the end of the ones you want and make sure you enable them to insert automatically. Ideally you can name the templates something unique like "myIf" so then you just can hit CTRL+Space while typing and it will fill in for you. Edited January 7, 20187 yr by jabelar Check out my tutorials here: http://jabelarminecraft.blogspot.com/
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.