repo for my hex addons :3
0
fork

Configure Feed

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

item moving

+28 -9
+1
src/main/resources/data/hexcasting/tags/action/per_world_pattern.json
··· 4 4 "hexcasting:craft/trinket", 5 5 "hexic:snow", 6 6 "hexic:findview", 7 + "hexic:moveconcept", 7 8 "hexic:moveentity" 8 9 ] 9 10 }
+1
src/main/resources/data/hexcasting/tags/action/requires_enlightenment.json
··· 2 2 "values": [ 3 3 "hexic:snow", 4 4 "hexic:findview", 5 + "hexic:moveconcept", 5 6 "hexic:moveentity" 6 7 ] 7 8 }
+26 -9
src/main/scala/org/eu/net/pool/hexic/Hexic.scala
··· 13 13 import at.petrak.hexcasting.api.casting.eval.{CastResult, CastingEnvironment, CastingEnvironmentComponent, MishapEnvironment, OperationResult, ResolvedPattern, ResolvedPatternType} 14 14 import at.petrak.hexcasting.api.casting.iota.* 15 15 import at.petrak.hexcasting.api.casting.math.{HexDir, HexPattern} 16 - import at.petrak.hexcasting.api.casting.mishaps.{Mishap, MishapBadCaster, MishapBadOffhandItem, MishapInvalidIota, MishapInvalidOperatorArgs, MishapNotEnoughArgs, MishapOthersName, MishapTooManyCloseParens} 16 + import at.petrak.hexcasting.api.casting.mishaps.{Mishap, MishapBadCaster, MishapBadOffhandItem, MishapInternalException, MishapInvalidIota, MishapInvalidOperatorArgs, MishapNotEnoughArgs, MishapOthersName, MishapTooManyCloseParens} 17 17 import at.petrak.hexcasting.api.pigment.FrozenPigment 18 18 import at.petrak.hexcasting.api.utils.{HexUtils, MediaHelper} 19 19 import at.petrak.hexcasting.common.lib.{HexAttributes, HexItems, HexRegistries, HexSounds} ··· 1791 1791 Patterns.mkConstAction(4): 1792 1792 case Seq(isIota[BoxedView.Instance, 3](from), isIota[BoxedView.Instance, 2](into), typ: VariantIota[?], isIota[DoubleIota, 0](count)) => 1793 1793 Using.resource(Transaction.openOuter()): 1794 - case given TransactionContext => 1794 + case tx@given TransactionContext => 1795 1795 val scale = conceptScale(ClassTag(typ.getClass)) 1796 1796 val toExtract = (scale * count.getDouble).toLong 1797 1797 val extract = from.view.tryExtract(typ.data, toExtract) ··· 1800 1800 val insert = into.view.tryInsert(typ.data, extract) 1801 1801 if insert < extract then 1802 1802 ??? // TODO: mishap 1803 + tx.commit() 1803 1804 Seq(DoubleIota(insert / scale)) 1804 1805 Patterns.register("moveentity", e"edeeewawdweaaddaqwqwqaddaaewdwawewdqd"): 1805 1806 Patterns.mkConstAction(3): ··· 2188 2189 def wrapReturn[T](body: (T => Nothing) => T): T = body(return _) 2189 2190 def wrapThrow[T, E <: Throwable](body: (E => Nothing) => T): T = wrapReturn[Try[T]](r => Success(body(r∘Failure))).get 2190 2191 2192 + inline def debugln(inline msg: String): Unit = 2193 + if isDev then println(msg) else () 2194 + 2195 + extension [T] (inline x: T) inline def trace(inline key: String): T = 2196 + debugln(s"$key: ${compiletime.codeOf(x)} = $x") 2197 + x 2198 + extension [T] (inline x: T) inline def trace(): T = 2199 + debugln(s"${compiletime.codeOf(x)} = $x") 2200 + x 2201 + 2191 2202 def propagateMishaps[T](env: CastingEnvironment)(body: => T): T = 2192 2203 wrapThrow[T, Mishap]: doThrow => 2193 2204 object key extends CastingEnvironmentComponent.Key[?] ··· 2256 2267 ) 2257 2268 class OfEntity(id: UUID)(using server: MinecraftServer) extends OfMerged(typeOfEntity, server.getWorlds.collectFirst(hexicVisibilityHack.unlifted(w => Option(w.getEntity(id)).map(Events.forEntity.invoker()(_)(using w)))).getOrElse(Seq())): 2258 2269 override def serialize = 2259 - val c = NbtCompound() 2270 + val c = super.serialize 2260 2271 c.putLong("m", id.getMostSignificantBits) 2261 2272 c.putLong("l", id.getLeastSignificantBits) 2262 2273 c 2263 2274 class OfBlock(pos: BlockPos)(using world: ServerWorld) extends OfMerged(typeOfBlock, Events.forBlock.invoker()(pos, world.getBlockState(pos))): 2264 2275 override def serialize = 2265 - val c = NbtCompound() 2276 + val c = super.serialize 2266 2277 val w = world.getRegistryKey.getValue 2267 2278 if w.getNamespace != "minecraft" then c.put("m", w.getNamespace) 2268 2279 if w.getPath != "overworld" then c.put("w", w.getPath) 2269 - c.put("u", pos.getX) 2270 - c.put("x", pos.getY) 2271 - c.put("v", pos.getZ) 2280 + c.putLong("p", pos.asLong) 2272 2281 c 2273 2282 class OfExactEntity(entity: => Entity)(using ServerWorld) extends InventoryView(typeOfExactEntity): 2274 2283 override val viewType = typeOfExactEntity 2275 2284 override def entities(using TransactionContext) = Set(entity) 2276 2285 override def serialize = 2277 - val c = NbtCompound() 2286 + val c = super.serialize 2278 2287 // TODO 2279 2288 c 2280 2289 def deserialize(data: NbtCompound)(using ServerWorld): Option[InventoryView] = for ··· 2293 2302 private given typeOfEntity: InventoryView.Type[OfEntity]: 2294 2303 override def deserialize(data: NbtCompound)(using ServerWorld): Option[OfEntity] = ??? 2295 2304 private given typeOfBlock: InventoryView.Type[OfBlock]: 2296 - override def deserialize(data: NbtCompound)(using ServerWorld): Option[OfBlock] = Some(data.get("p")).map(_.downcast[NbtLong].longValue).map(BlockPos.fromLong).map(OfBlock(_)) 2305 + override def deserialize(data: NbtCompound)(using ServerWorld): Option[OfBlock] = 2306 + for 2307 + case posLong: NbtLong <- Option(data.get("p")).trace("key") 2308 + pos = BlockPos.fromLong(posLong.longValue) 2309 + namespace = Option(data.getString("m")).filter(!_.isBlank) getOrElse "minecraft" 2310 + path = Option(data.getString("w")).filter(!_.isBlank) getOrElse "overworld" 2311 + key = RegistryKey.of(RegistryKeys.WORLD, Identifier.of(namespace, path)).trace("key") 2312 + given ServerWorld <- Option(summon[ServerWorld].getServer.getWorld(key)) 2313 + yield OfBlock(pos) 2297 2314 private given typeOfExactEntity: InventoryView.Type[OfExactEntity]: 2298 2315 override def deserialize(data: NbtCompound)(using ServerWorld): Option[OfExactEntity] = ??? 2299 2316 registry("sum") = typeOfSum