diff --git a/core/src/main/kotlin/com/willfp/libreforge/effects/Effects.kt b/core/src/main/kotlin/com/willfp/libreforge/effects/Effects.kt index 7d6ab39c9..6778473ad 100644 --- a/core/src/main/kotlin/com/willfp/libreforge/effects/Effects.kt +++ b/core/src/main/kotlin/com/willfp/libreforge/effects/Effects.kt @@ -112,6 +112,7 @@ import com.willfp.libreforge.effects.impl.EffectSellMultiplier import com.willfp.libreforge.effects.impl.EffectSendMessage import com.willfp.libreforge.effects.impl.EffectSendTitle import com.willfp.libreforge.effects.impl.EffectSetBlock +import com.willfp.libreforge.effects.impl.EffectSetCustomModelData import com.willfp.libreforge.effects.impl.EffectSetFreezeTicks import com.willfp.libreforge.effects.impl.EffectSetGlobalPoints import com.willfp.libreforge.effects.impl.EffectSetItemPoints @@ -455,5 +456,6 @@ object Effects : Registry>() { register(EffectMultiplyItemPoints) register(EffectSetGlobalPoints) register(EffectSetItemPoints) + register(EffectSetCustomModelData) } } diff --git a/core/src/main/kotlin/com/willfp/libreforge/effects/impl/EffectSetCustomModelData.kt b/core/src/main/kotlin/com/willfp/libreforge/effects/impl/EffectSetCustomModelData.kt new file mode 100644 index 000000000..dcc4dc8db --- /dev/null +++ b/core/src/main/kotlin/com/willfp/libreforge/effects/impl/EffectSetCustomModelData.kt @@ -0,0 +1,29 @@ +package com.willfp.libreforge.effects.impl + +import com.willfp.eco.core.config.interfaces.Config +import com.willfp.libreforge.NoCompileData +import com.willfp.libreforge.arguments +import com.willfp.libreforge.effects.Effect +import com.willfp.libreforge.getIntFromExpression +import com.willfp.libreforge.triggers.TriggerData +import com.willfp.libreforge.triggers.TriggerParameter + +object EffectSetCustomModelData : Effect("set_custom_model_data") { + override val parameters = setOf( + TriggerParameter.ITEM + ) + + override val arguments = arguments { + require("model", "You must specify the custom model data ID!") + } + + override fun onTrigger(config: Config, data: TriggerData, compileData: NoCompileData): Boolean { + val item = data.item ?: return false + val meta = item.itemMeta ?: return false + + meta.setCustomModelData(config.getIntFromExpression("model", data)) + item.itemMeta = meta + + return true + } +}