repo for my hex addons :3
0
fork

Configure Feed

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

entity teleportation (idk if it works cross-world yet)

+18 -7
+18 -7
src/main/scala/org/eu/net/pool/hexic/Hexic.scala
··· 1806 1806 Patterns.mkConstAction(3): 1807 1807 case Seq(isIota[BoxedView.Instance, 2](from), isIota[BoxedView.Instance, 1](into), isIota[DoubleIota, 0](count)) => 1808 1808 Using.resource(Transaction.openOuter()): 1809 - case given TransactionContext => 1810 - Seq(DoubleIota(from.view.entities.count(into.view.teleportEntity))) 1809 + case tx@given TransactionContext => 1810 + val count = from.view.entities.count(into.view.teleportEntity) 1811 + if count > 0 then tx.commit() 1812 + Seq(DoubleIota(count)) 1811 1813 Patterns.register("metatable", se"deaqqwqqqeaeqqqeadedaqaaee"): 1812 1814 Patterns.mkConstAction(4): 1813 1815 case Seq(userdata, display, isIota[Vec3Iota, 1](color), isIota[PropertyIota, 0](metatable)) => ··· 2319 2321 registry("exact") = typeOfExactEntity 2320 2322 Events.forBlock.register: (pos, state) => 2321 2323 val storage = ItemStorage.SIDED.find(summon, pos, null): Storage[ItemVariant] 2322 - val allowTP = state.isTransparent(summon, pos) 2323 2324 if storage == null then Seq() 2324 2325 else Seq( 2325 2326 new Handler: ··· 2331 2332 variant match 2332 2333 case i: ItemVariant => storage.extract(i, amount, summon) 2333 2334 case _ => 0 2335 + ) 2336 + Events.forBlock.register: (pos, state) => 2337 + if state.isTransparent(summon, pos) then 2338 + Seq(new Handler: 2334 2339 override def entities(using TransactionContext): Set[Entity] = summon[World].getOtherEntities(null, MCBox.of(pos.toCenterPos, 0.5, 0.5, 0.5), _ => true).toSet 2335 2340 override def teleportEntity(ent: Entity)(using TransactionContext, CastingEnvironment): Boolean = 2336 - if allowTP then 2337 - ??? 2338 - else false 2339 - ) 2341 + var currEnt = ent 2342 + object partip extends SnapshotParticipant[(Vec3d, ServerWorld)]: 2343 + override def createSnapshot(): (Vec3d, ServerWorld) = (currEnt.getPos, currEnt.getWorld.asInstanceOf[ServerWorld]) 2344 + override def readSnapshot(snapshot: (Vec3d, ServerWorld)): Unit = 2345 + currEnt = FabricDimensions.teleport(currEnt, snapshot._2, TeleportTarget(snapshot._1, currEnt.getVelocity, currEnt.getYaw, currEnt.getPitch)) 2346 + partip.updateSnapshots(summon) 2347 + partip.readSnapshot(pos.toCenterPos.subtract(0, 0.25, 0), summon) 2348 + true 2349 + ) 2350 + else Seq() 2340 2351 2341 2352 object BoxedView extends IotaType[BoxedView.Instance]: 2342 2353 InventoryView