repo for my hex addons :3
0
fork

Configure Feed

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

exact entity handling, and use entity sets

+5 -3
+5 -3
src/main/scala/org/eu/net/pool/hexic/Hexic.scala
··· 2172 2172 def apply(idx: Int)(using CastingEnvironment): Option[SlotReference] = None 2173 2173 @throws[Mishap] 2174 2174 def tryWithdraw(variant: TransferVariant[?], amount: Long)(using TransactionContext, CastingEnvironment): Long = 0 2175 - def entities(using TransactionContext): Iterable[Entity] = Iterable() 2175 + def entities(using TransactionContext): Set[Entity] = Set() 2176 2176 @throws[Mishap] 2177 2177 def teleportEntity(ent: Entity)(using TransactionContext, CastingEnvironment): Boolean = false 2178 2178 ··· 2187 2187 def getViews = views 2188 2188 override def apply(idx: Int)(using CastingEnvironment): Option[SlotReference] = views.collectFirst(hexicVisibilityHack.unlifted(_(idx))) 2189 2189 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 - override def entities(using TransactionContext): Iterable[Entity] = views.flatMap(_.entities) 2190 + override def entities(using TransactionContext) = views.flatMap(_.entities).toSet 2191 2191 override def teleportEntity(ent: Entity)(using TransactionContext, CastingEnvironment): Boolean = views.iterator∃(_.teleportEntity(ent)) 2192 - class OfEntity(entity: => Entity)(using ServerWorld) extends OfMerged(Events.forEntity.invoker()(entity)) 2192 + class OfEntity(entity: => Option[Entity])(using world: ServerWorld) extends OfMerged(entity.fold(Seq())(Events.forEntity.invoker()(_))) 2193 2193 class OfBlock(pos: BlockPos)(using world: ServerWorld) extends OfMerged(Events.forBlock.invoker()(pos, world.getBlockState(pos))) 2194 + class OfExactEntity(entity: => Entity)(using ServerWorld) extends InventoryView: 2195 + override def entities(using TransactionContext) = Set(entity) 2194 2196 2195 2197 object SlotReference extends Registrar[SlotReference.Type[?]]("slot"): 2196 2198 class Type[T <: SlotReference: Codec]