Skip to content

Commit

Permalink
Update ModAdvancement.kt
Browse files Browse the repository at this point in the history
  • Loading branch information
EngineMachiner committed Aug 4, 2024
1 parent bc9b064 commit 2b15360
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/main/kotlin/com/enginemachiner/harmony/ModAdvancement.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,35 +12,32 @@ private typealias Conditions = AbstractCriterionConditions
/** Advancement builder for custom mod advancements in Data Generation. */
abstract class ModAdvancement : ModID {

open val name: String = lazy { className() }.value

abstract val icon: Item

open val parent: ModAdvancement? = null
open val name: String = lazy { className() }.value

open val parent: ModAdvancement? = null

open val key: String = lazy { name }.value

open fun title(): Text { return Translation.Advancement.title(key) }
open fun description(): Text { return Translation.Advancement.description(key) }


open val frame = AdvancementFrame.TASK
open val background = Identifier("textures/gui/advancements/backgrounds/adventure.png")


private val toast = false; private val announce = false
private val hidden = false


private var advancement: Advancement? = null

abstract fun conditions(): AbstractCriterionConditions

fun build( consumer: Consumer<Advancement>, conditions: Conditions, criterion: String = name ): Advancement {
fun build( consumer: Consumer<Advancement>, criterion: String = name ): Advancement {

val advancement = Advancement.Builder.create()
.display( icon, title(), description(), background, frame, toast, announce, hidden )
.parent( parent?.advancement ).criterion( criterion, conditions )
.parent( parent?.advancement ).criterion( criterion, conditions() )
.build( consumer, "$MOD_NAME/$name" )

this.advancement = advancement; return advancement
Expand Down

0 comments on commit 2b15360

Please sign in to comment.