package Ġcom . he a 3 ven . tools . gradle . autom c Ċ Ċ import Ġnet . minecraftforge . gradle . user . patch er User . forge . Forge Extension Ċ import Ġorg . gradle . api . Java Version Ċ import Ġorg . gradle . api . Project Ċ import Ġorg . gradle . api . internal . artifacts . dependencies . Default Client Module Ċ import Ġorg . gradle . api . internal . plugins . Plugin ApplicationException Ċ import Ġorg . gradle . api . plugins . Extra Properties Extension Ċ import Ġorg . gradle . jvm . tasks . Jar Ċ import Ġorg . gradle . test fixtures . Project Builder Ċ import Ġorg . junit . Assert .* Ċ import Ġorg . junit . Test Ċ Ċ class ĠAuto Mc Plugin Test Ġ{ Ċ ĉ val Ġdefault Props Ġ= Ġmap Of ( Ċĉĉ ĉ " project _ name " Ġto Ġ" Test Mod ", Ċĉĉ ĉ " project _ version " Ġto Ġ" 1 . 2 . 3 ", Ċĉĉ ĉ " project _ group " Ġto Ġ" com . test . mod ", Ċĉĉ ĉ " project _ prop _ file " Ġto Ġ" src / main / java / Project Properties . java ", Ċĉĉ ĉ " version _ mc " Ġto Ġ" 1 . 1 0 . 2 ", Ċĉĉ ĉ " version _ forge " Ġto Ġ" 1 2 . 1 8 . 1 . 2 0 2 5 ", Ċĉĉ ĉ " version _ mappings " Ġto Ġ" snapshot _ 2 0 1 6 0 4 1 9 " Ċ ĉ ) ĊĊ ĉ @ Test Ċ ĉ fun Ġsets Project Version () Ġ{ Ċĉ ĉ val Ġproj Ġ= Ġcreate Project () ĊĊĉ ĉ assertEquals (" 1 . 1 0 . 2 - 1 . 2 . 3 ", Ġproj . version ) Ċ ĉ } ĊĊ ĉ @ Test Ċ ĉ fun Ġsets Project Group () Ġ{ Ċĉ ĉ val Ġproj Ġ= Ġcreate Project () ĊĊĉ ĉ assertEquals (" com . test . mod ", Ġproj . group ) Ċ ĉ } ĊĊ ĉ @ Test Ċ ĉ fun Ġsets Project Arch ives Base Name () Ġ{ Ċĉ ĉ val Ġproj Ġ= Ġcreate Project () ĊĊĉ ĉ assertEquals (" Test Mod ", Ġproj . get Prop < String >(" archives Base Name ")) Ċ ĉ } ĊĊ ĉ @ Test Ċ ĉ fun Ġsets Project Java Version To 8 () Ġ{ Ċĉ ĉ val Ġproj Ġ= Ġcreate Project () ĊĊĉ ĉ assertEquals ( Java Version . VERSION _ 1 _ 8 , Ġproj . get Prop < String >(" source Compatibility ")) Ċĉ ĉ assertEquals ( Java Version . VERSION _ 1 _ 8 , Ġproj . get Prop < String >(" target Compatibility ")) Ċ ĉ } ĊĊ ĉ @ Test Ċ ĉ fun Ġsets Minecraft Version () Ġ{ Ċĉ ĉ val Ġproj Ġ= Ġcreate Project () ĊĊĉ ĉ val Ġmc Ġ= Ġproj . get Prop < Forge Extension >(" minecraft ") Ċĉ ĉ assertEquals (" 1 . 1 0 . 2 ", Ġmc . version ) Ċĉ ĉ assertEquals (" 1 2 . 1 8 . 1 . 2 0 2 5 ", Ġmc . forge Version ) Ċ ĉ } ĊĊ ĉ @ Test Ċ ĉ fun Ġsets Minecraft Version With Branch () Ġ{ Ċĉ ĉ val Ġproj Ġ= Ġcreate Project ( map Of (" version _ mc " Ġto Ġ" 1 . 1 0 ", Ċĉĉĉ ĉ " version _ forge " Ġto Ġ" 1 2 . 1 8 . 0 . 1 9 9 4 ", Ċĉĉĉ ĉ " version _ forge _ branch " Ġto Ġ" 1 . 1 0 . 0 ")) ĊĊĉ ĉ val Ġmc Ġ= Ġproj . get Prop < Forge Extension >(" minecraft ") Ċĉ ĉ assertEquals (" 1 . 1 0 ", Ġmc . version ) Ċĉ ĉ assertEquals (" 1 2 . 1 8 . 0 . 1 9 9 4 - 1 . 1 0 . 0 ", Ġmc . forge Version ) Ċ ĉ } ĊĊ ĉ @ Test Ċ ĉ fun Ġsets Mappings Version () Ġ{ Ċĉ ĉ val Ġproj Ġ= Ġcreate Project () ĊĊĉ ĉ val Ġmc Ġ= Ġproj . get Prop < Forge Extension >(" minecraft ") Ċĉ ĉ assertEquals (" snapshot _ 2 0 1 6 0 4 1 9 ", Ġmc . mappings ) Ċ ĉ } ĊĊ ĉ @ Test Ċ ĉ fun Ġsets Run Dir () Ġ{ Ċĉ ĉ val Ġproj Ġ= Ġcreate Project () ĊĊĉ ĉ val Ġmc Ġ= Ġproj . get Prop < Forge Extension >(" minecraft ") Ċĉ ĉ assertEquals (" run ", Ġmc . run Dir ) Ċ ĉ } ĊĊ ĉ @ Test Ċ ĉ fun Ġdoesnt Sets Core Mod ByDefault () Ġ{ Ċĉ ĉ val Ġproj Ġ= Ġcreate Project () ĊĊĉ ĉ val Ġmc Ġ= Ġproj . get Prop < Forge Extension >(" minecraft ") Ċĉ ĉ assertEquals ( null , Ġmc . core Mod ) Ċĉ ĉ assertFalse ( proj . get Prop < Jar >(" jar "). manifest . attributes . containsKey (" F ML Core Plugin Contains F ML Mod ")) Ċ ĉ } ĊĊ ĉ @ Test Ċ ĉ fun Ġsets Core Mod () Ġ{ Ċĉ ĉ val Ġproj Ġ= Ġcreate Project ( map Of (" project _ core mod " Ġto Ġ" com . test . mod . Loading Plugin Test Mod ")) ĊĊĉ ĉ val Ġmc Ġ= Ġproj . get Prop < Forge Extension >(" minecraft ") Ċĉ ĉ assertEquals (" com . test . mod . Loading Plugin Test Mod ", Ġmc . core Mod ) Ċĉ ĉ assertEquals (" true ", Ġproj . get Prop < Jar >(" jar "). manifest . attributes [" F ML Core Plugin Contains F ML Mod "]) Ċ ĉ } ĊĊ ĉ @ Test ( expected Ġ= ĠPlugin ApplicationException :: class ) Ċ ĉ fun Ġerror When Missing ProjectName () Ġ{ Ċĉ ĉ val Ġprops Ġ= Ġmutable Map Of (*( defaultProps . map Ġ{ Ġit . key Ġto Ġit . value Ġ}. to Typed Array ())) Ċĉ ĉ props . remove (" project _ name ") Ċĉ ĉ create Project ( props , Ġfalse ) Ċ ĉ } ĊĊ ĉ @ Test ( expected Ġ= ĠPlugin ApplicationException :: class ) Ċ ĉ fun Ġerror When Missing Project Version () Ġ{ Ċĉ ĉ val Ġprops Ġ= Ġmutable Map Of (*( defaultProps . map Ġ{ Ġit . key Ġto Ġit . value Ġ}. to Typed Array ())) Ċĉ ĉ props . remove (" project _ version ") Ċĉ ĉ create Project ( props , Ġfalse ) Ċ ĉ } ĊĊ ĉ @ Test ( expected Ġ= ĠPlugin ApplicationException :: class ) Ċ ĉ fun Ġerror When Missing Project Group () Ġ{ Ċĉ ĉ val Ġprops Ġ= Ġmutable Map Of (*( defaultProps . map Ġ{ Ġit . key Ġto Ġit . value Ġ}. to Typed Array ())) Ċĉ ĉ props . remove (" project _ group ") Ċĉ ĉ create Project ( props , Ġfalse ) Ċ ĉ } ĊĊ ĉ @ Test ( expected Ġ= ĠPlugin ApplicationException :: class ) Ċ ĉ fun Ġerror When Missing Version Mc () Ġ{ Ċĉ ĉ val Ġprops Ġ= Ġmutable Map Of (*( defaultProps . map Ġ{ Ġit . key Ġto Ġit . value Ġ}. to Typed Array ())) Ċĉ ĉ props . remove (" version _ mc ") Ċĉ ĉ create Project ( props , Ġfalse ) Ċ ĉ } ĊĊ ĉ @ Test ( expected Ġ= ĠPlugin ApplicationException :: class ) Ċ ĉ fun Ġerror When Missing Version Forge () Ġ{ Ċĉ ĉ val Ġprops Ġ= Ġmutable Map Of (*( defaultProps . map Ġ{ Ġit . key Ġto Ġit . value Ġ}. to Typed Array ())) Ċĉ ĉ props . remove (" version _ forge ") Ċĉ ĉ create Project ( props , Ġfalse ) Ċ ĉ } ĊĊ ĉ @ Test ( expected Ġ= ĠPlugin ApplicationException :: class ) Ċ ĉ fun Ġerror When Missing Version Mappings () Ġ{ Ċĉ ĉ val Ġprops Ġ= Ġmutable Map Of (*( defaultProps . map Ġ{ Ġit . key Ġto Ġit . value Ġ}. to Typed Array ())) Ċĉ ĉ props . remove (" version _ mappings ") Ċĉ ĉ create Project ( props , Ġfalse ) Ċ ĉ } ĊĊ ĉ @ Test Ċ ĉ fun Ġcreates Copy Source Task When Kotlin Plugin IsEnabled () Ġ{ Ċĉ ĉ val Ġproj Ġ= ĠProject Builder . builder (). build () Ċĉ ĉ val Ġext Ġ= Ġproj . get Prop < Extra Properties Extension >(" ext ") Ċĉ ĉ for Ġ( prop Name Ġin Ġdefault Props . keys ) Ġ{ Ċĉĉ ĉ ext . set ( prop Name , Ġdefault Props [ prop Name ]) Ċĉ ĉ } Ċĉ ĉ proj . build script . repositories . maven Central () Ċĉ ĉ proj . build script . dependencies . add (" classpath ", Ċĉĉĉ ĉ Default Client Module (" org . jetbrains . kotlin ", Ġ" kotlin - gradle - plugin ", Ġ" 1 . 0 . 3 ")) Ċĉ ĉ proj . plugin Manager . apply (" kotlin ") Ċĉ ĉ proj . plugin Manager . apply (" net . minecraftforge . gradle . forge ") Ċĉ ĉ proj . plugin Manager . apply (" com . he a 3 ven . tools . gradle . autom c ") ĊĊĉ ĉ assertNotNull ( proj . tasks . get ByName (" source Api Kotlin ")) Ċĉ ĉ assertNotNull ( proj . tasks . get ByName (" source Main Kotlin ")) Ċĉ ĉ assertNotNull ( proj . tasks . get ByName (" source Test Kotlin ")) Ċ ĉ } ĊĊ ĉ @ Test Ċ ĉ fun Ġadds Project Properties File ToBe Processed () Ġ{ Ċĉ ĉ val Ġproj Ġ= Ġcreate Project () ĊĊĉ ĉ val Ġmc Ġ= Ġproj . get Prop < Forge Extension >(" minecraft ") Ċĉ ĉ assertTrue ( mc . includes . contains (" src / main / java / Project Properties . java ")) Ċ ĉ } ĊĊ ĉ @ Test Ċ ĉ fun Ġadds Project Version As Property ToBe Re placed () Ġ{ Ċĉ ĉ val Ġproj Ġ= Ġcreate Project () ĊĊĉ ĉ val Ġmc Ġ= Ġproj . get Prop < Forge Extension >(" minecraft ") Ċĉ ĉ assertEquals (" 1 . 1 0 . 2 - 1 . 2 . 3 ", Ġmc . replacement s . get (" PROJECT VERSION ")) Ċ ĉ } ĊĊ ĉ @ Test Ċ ĉ fun Ġadds Mc Version As Property ToBe Re placed () Ġ{ Ċĉ ĉ val Ġproj Ġ= Ġcreate Project () ĊĊĉ ĉ val Ġmc Ġ= Ġproj . get Prop < Forge Extension >(" minecraft ") Ċĉ ĉ assertEquals (" 1 . 1 0 . 2 ", Ġmc . replacement s . get (" MC VERSION ")) Ċ ĉ } ĊĊ ĉ @ Test Ċ ĉ fun Ġadds Forge Version As Property ToBe Re placed () Ġ{ Ċĉ ĉ val Ġproj Ġ= Ġcreate Project () ĊĊĉ ĉ val Ġmc Ġ= Ġproj . get Prop < Forge Extension >(" minecraft ") Ċĉ ĉ assertEquals (" 1 2 . 1 8 . 1 . 2 0 2 5 ", Ġmc . replacement s . get (" FOR GE VERSION ")) Ċ ĉ } ĊĊ ĉ @ Test Ċ ĉ fun Ġadds Forge Dependency As Property ToBe Re placed () Ġ{ Ċĉ ĉ val Ġproj Ġ= Ġcreate Project () ĊĊĉ ĉ val Ġmc Ġ= Ġproj . get Prop < Forge Extension >(" minecraft ") Ċĉ ĉ assertEquals (" required - after : Forge @ [ 1 2 . 1 8 . 1 . 2 0 2 5 , )", Ġmc . replacement s . get (" FOR GE DEPEND ENCY ")) Ċ ĉ } ĊĊ ĉ private Ġfun Ġcreate Project ( props : ĠMap < String , ĠString > Ġ= Ġempty Map (), Ġuse Defaults : ĠBoolean Ġ= Ġtrue ): ĠProject Ġ{ Ċĉ ĉ val Ġproj Ġ= ĠProject Builder . builder (). build () Ċĉ ĉ val Ġext Ġ= Ġproj . get Prop < Extra Properties Extension >(" ext ") Ċĉ ĉ for Ġ( prop Name Ġin Ġdefault Props . keys . union ( props . keys )) Ġ{ Ċĉĉ ĉ if Ġ( props . containsKey ( prop Name ) Ġ|| Ġuse Defaults ) Ċĉĉĉ ĉ ext . set ( prop Name , Ġprops [ prop Name ] Ġ?: Ġdefault Props [ prop Name ]) Ċĉ ĉ } Ċĉ ĉ proj . plugin Manager . apply (" net . minecraftforge . gradle . forge ") Ċĉ ĉ proj . plugin Manager . apply (" com . he a 3 ven . tools . gradle . autom c ") Ċĉ ĉ return Ġproj Ċ ĉ } ĊĊ ĉ @ Suppress (" UN CHECK ED _ CAST ") Ċ ĉ private Ġfun Ġ< T > ĠProject . get Prop ( name : ĠString ) Ġ= Ġfind Property ( name ) Ġas ĠT Ċ } Ċ