repo for my hex addons :3
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

view truthiness

+2
+2
src/main/scala/org/eu/net/pool/hexic/Hexic.scala
··· 2170 2170 2171 2171 trait InventoryView(val viewType: InventoryView.Type[?]): 2172 2172 def apply(idx: Int)(using CastingEnvironment): Option[SlotReference] = None 2173 + def isTruthy = true 2173 2174 @throws[Mishap] 2174 2175 def tryWithdraw(variant: TransferVariant[?], amount: Long)(using TransactionContext, CastingEnvironment): Long = 0 2175 2176 def entities(using TransactionContext): Set[Entity] = Set() ··· 2185 2186 val forBlock: Event[(BlockPos, BlockState) => ServerWorld ?=> Seq[InventoryView]] = EventFactory.createArrayBacked[(BlockPos, BlockState) => ServerWorld ?=> Seq[InventoryView]](classOf, (_, _) => Seq(), fns => (pos, state) => fns.flatMap(_(pos, state))) 2186 2187 abstract class OfMerged(viewType: InventoryView.Type[?], views: => Seq[InventoryView]) extends InventoryView(viewType): 2187 2188 def getViews = views 2189 + override def isTruthy = views ∃(_.isTruthy) 2188 2190 override def apply(idx: Int)(using CastingEnvironment): Option[SlotReference] = views.collectFirst(hexicVisibilityHack.unlifted(_(idx))) 2189 2191 override def tryWithdraw(variant: TransferVariant[?], amount: Long)(using TransactionContext, CastingEnvironment): Long = LazyList.from(views).scanLeft(0L)((n, view) => view.tryWithdraw(variant, amount - n) + n).findFirstOrLast(_ >= amount).getOrElse(0) 2190 2192 override def entities(using TransactionContext) = views.flatMap(_.entities).toSet