Skip to content

Commit

Permalink
chore: SpreadOperator (#5315)
Browse files Browse the repository at this point in the history
  • Loading branch information
MukjepScarlet authored Jan 14, 2025
1 parent 504bdb7 commit 7be66d7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,14 @@ import net.minecraft.item.ItemStack
import net.minecraft.registry.Registries
import net.minecraft.registry.Registry
import net.minecraft.util.Identifier
import java.util.function.Supplier

/**
* An item group from the client
*/
open class ClientItemGroup(
val plainName: String,
val icon: () -> ItemStack,
val icon: Supplier<ItemStack>,
val items: (items: ItemGroup.Entries) -> Unit
) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ class ExploitsItemGroup : ClientItemGroup(
it.add(ItemStack(Items.DEBUG_STICK))

// Add unobtainable potions
@Suppress("SpreadOperator")
it.add(createSplashPotion("Troll Potion", *Registries.STATUS_EFFECT.streamEntries().map { statusEffect ->
StatusEffectInstance(statusEffect, Int.MAX_VALUE, 127)
}.toArray { len -> arrayOfNulls(len) }))
it.add(createSplashPotion("Troll Potion",
effects = Registries.STATUS_EFFECT.streamEntries().map { statusEffect ->
StatusEffectInstance(statusEffect, Int.MAX_VALUE, 127)
}.toArray(::arrayOfNulls)))

it.add(createSplashPotion("Kill Potion",
StatusEffectInstance(StatusEffects.INSTANT_HEALTH, 0, 125),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,9 @@ class ScriptCommandBuilder(private val commandObject: Value) {
emptyArray()
}

@Suppress("SpreadOperator")
val commandBuilder = CommandBuilder
.begin(commandObject.getMember("name").asString())
.alias(*aliases)
.alias(aliases = aliases)

if (commandObject.hasMember("subcommands")) {
val subcommands = commandObject.getMember("subcommands").`as`(Array<Value>::class.java)
Expand Down

0 comments on commit 7be66d7

Please sign in to comment.