Provide direct set operator

This commit is contained in:
DBotThePony 2025-03-06 18:22:04 +07:00
parent a73ad5484d
commit bc2cfccffe
Signed by: DBot
GPG Key ID: DCC23B5715498507

View File

@ -23,11 +23,15 @@ import java.util.function.Predicate
* and actual implementations of this interface are likely to provide efficient method implementations in place of derived/emulated ones.
*/
interface IEnhancedContainer : IContainer, RecipeInput, Iterable<ItemStack>, StackedContentsCompatible {
// provide non-ambiguous "get" operator
// provide non-ambiguous get and set operators
operator fun get(slot: Int): ItemStack {
return getItem(slot)
}
operator fun set(slot: Int, value: ItemStack) {
setItem(slot, value)
}
fun containerSlot(slot: Int): IContainerSlot {
return IContainerSlot.Simple(slot, this)
}