repo for my hex addons :3
0
fork

Configure Feed

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

mrow

+36 -10
+29
project/hexic/src/client/scala/org/eu/net/pool/hexic/client.scala
··· 1 1 package org.eu.net.pool 2 2 package hexic 3 3 4 + import at.petrak.hexcasting.api.casting.math.{HexDir, HexPattern} 4 5 import at.petrak.hexcasting.api.item.PigmentItem 5 6 import at.petrak.hexcasting.api.mod.HexTags 6 7 import at.petrak.hexcasting.api.pigment.FrozenPigment 8 + import at.petrak.hexcasting.interop.inline.InlinePatternData 7 9 import com.google.gson.reflect.TypeToken 8 10 import com.google.gson.{Gson, JsonArray, JsonObject} 9 11 import com.llamalad7.mixinextras.injector.wrapoperation.Operation 12 + import com.samsthenerd.inline.api.client.InlineClientAPI 13 + import net.fabricmc.fabric.api.client.item.v1.ItemTooltipCallback 14 + import com.samsthenerd.inline.api.matching.{InlineMatch, InlineMatcher, MatcherInfo, RegexMatcher} 10 15 import dev.emi.trinkets.api.{TrinketComponent, TrinketsApi} 11 16 import kotlin.jvm.JvmField 12 17 import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking ··· 15 20 import net.fabricmc.fabric.api.datagen.v1.provider.{FabricLanguageProvider, FabricModelProvider, FabricRecipeProvider, FabricTagProvider} 16 21 import net.fabricmc.fabric.api.networking.v1.PacketByteBufs 17 22 import net.fabricmc.fabric.api.transfer.v1.item.ItemVariant 23 + import net.minecraft.text.Text 24 + import java.util.function.UnaryOperator 18 25 import net.minecraft.advancement.criterion.InventoryChangedCriterion 19 26 import net.minecraft.block.entity.{BlockEntity, BlockEntityType} 20 27 import net.minecraft.client.MinecraftClient ··· 105 112 val k = s"layer$i" 106 113 if !json.ItemModelGenerator.LAYERS.contains(k) then 107 114 json.ItemModelGenerator.LAYERS.add(k) 115 + InlineClientAPI.INSTANCE.addMatcher: 116 + RegexMatcher.Simple(regex = "([ns]?[ew])\"([qweasd]*)\"", 117 + id = "scala_pattern", 118 + matcher = 119 + m => InlineMatch.DataMatch(InlinePatternData(HexPattern.fromAnglesUnchecked( 120 + m.group(2), 121 + m.group(1) match 122 + case "ne" => HexDir.NORTH_EAST 123 + case "e" => HexDir.EAST 124 + case "se" => HexDir.SOUTH_EAST 125 + case "sw" => HexDir.SOUTH_WEST 126 + case "w" => HexDir.WEST 127 + case "nw" => HexDir.NORTH_WEST 128 + ))), 129 + info = MatcherInfo.fromId("scala_pattern")) 108 130 phlib.Events.registryLookup.register: 109 131 val preferredColor = DyeColor.values()(client.getSession.getUuidOrNull.getLeastSignificantBits.abs.%(16).toInt) 110 132 val preferredStringworm = stringworms(Stringworm.flavors(client.getSession.getUuidOrNull.getLeastSignificantBits.abs.%(48).*(7).%(4).toInt)) ··· 124 146 handler.sendChatCommand(s.drop(1)) 125 147 else 126 148 handler.sendChatMessage(s)) 149 + ItemTooltipCallback.EVENT.register: (stack, ctx, lines) => 150 + stack.getItem match 151 + case _: Mediaweave if Option(stack.getNbt).exists(_.get("lock") != null) => 152 + lines.append(Text.literal("Tied").styled(_.withColor(0x782fe0))) 153 + lines.append(Text.literal("Cannot be unequipped and won't be dropped on death.").styled(_.withColor(0x4b1d8c))) 154 + lines.append(Text.literal("Use ").append(Text.empty().append(InlinePatternData(sw"aqeqqqwqqqqqaqwqa").asText(withExtra=false)).styled(_.withColor(0x782fe0))).append(" to untie.").styled(_.withColor(0x4b1d8c))) 155 + case _ => 127 156 128 157 extension (s: DyeColor) def humanName: String = s.getName.split('_').map(_.capitalize).mkString(" ") 129 158
-7
project/hexic/src/main/scala/org/eu/net/pool/hexic/main.scala
··· 1862 1862 val x = pos.getComponentAlongAxis(axis) 1863 1863 if x < 0 || x >= 11 then boundary.break(false) 1864 1864 true 1865 - ItemTooltipCallback.EVENT.register: (stack, ctx, lines) => 1866 - stack.getItem match 1867 - case _: Mediaweave if Option(stack.getNbt).exists(_.get("lock") != null) => 1868 - lines.append(Text.literal("Tied").styled(_.withColor(0x782fe0))) 1869 - lines.append(Text.literal("Cannot be unequipped and won't be dropped on death.").styled(_.withColor(0x4b1d8c))) 1870 - lines.append(Text.literal("Use ").append(Text.empty().append(InlinePatternData(sw"aqeqqqwqqqqqaqwqa").asText(withExtra=false)).styled(_.withColor(0x782fe0))).append(" to untie.").styled(_.withColor(0x4b1d8c))) 1871 - case _ => 1872 1865 // dump patterns 1873 1866 val out = Files.newOutputStream(Path.of("patterns.csv")) 1874 1867 try
+7 -3
project/hexic/src/main/scala/org/eu/net/pool/hexic/views.scala
··· 6 6 import at.petrak.hexcasting.api.casting.iota.* 7 7 import at.petrak.hexcasting.api.casting.mishaps.{Mishap, MishapInvalidIota} 8 8 import com.mojang.serialization.Codec 9 + import com.samsthenerd.inline.api.InlineAPI 9 10 import com.samsthenerd.inline.api.data.ItemInlineData 11 + import com.samsthenerd.inline.impl.InlineStyle 10 12 import net.fabricmc.fabric.api.dimension.v1.FabricDimensions 11 13 import net.fabricmc.fabric.api.event.{Event, EventFactory} 12 14 import net.fabricmc.fabric.api.transfer.v1.fluid.FluidVariant ··· 348 350 new TaggedVariant: 349 351 type T = Item 350 352 def variant: TransferVariant[Item] = s 351 - def display: Text = t"${s.getItem.getName(s.toStack)}: ${ItemInlineData(s.toStack).asText(true)}" 352 - .styled(_.withHoverEvent(HoverEvent(HoverEvent.Action.SHOW_ITEM, HoverEvent.ItemStackContent(s.toStack)))) 353 + def display: Text = t"⌠${ItemInlineData(s.toStack).asText(true).copy().styled(InlineAPI.INSTANCE.withSizeModifier(_, 1.5))}⌡" 354 + .styled(_.withColor(0x7c7145).withHoverEvent(HoverEvent(HoverEvent.Action.SHOW_ITEM, HoverEvent.ItemStackContent(s.toStack)))) 353 355 registry(Identifier("fluid")) = c => 354 356 val s = FluidVariant.fromNbt(c) 355 357 Option.unless(s.isBlank): 356 358 new TaggedVariant: 357 359 type T = Fluid 358 360 def variant: TransferVariant[Fluid] = s 359 - def display: MutableText = t"${s.getFluid.getDefaultState.getBlockState.getBlock.getName}: ${ItemInlineData.make(s.getFluid.getBucketItem.getDefaultStack)}" 361 + def display: MutableText = 362 + val bs = s.getFluid.getDefaultState.getBlockState 363 + t"(${bs.getBlock.getName.styled(_.withColor(bs.getMapColor(null, null).color))})".styled(_.withColor(0x3c5e34)) 360 364 registry("media") = c => 361 365 Some(new TaggedVariant: 362 366 type T = SingletonVariant