repo for my hex addons :3
0
fork

Configure Feed

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

hexic cleanup

+17 -81
+2 -5
project/hexic/src/client/resources/hexic.client.mixins.json
··· 4 4 "package": "org.eu.net.pool.hexic.mixin.client", 5 5 "compatibilityLevel": "JAVA_17", 6 6 "client": [ 7 - "org.eu.net.pool.hexxytounge.mixin.ChatHudMixin", 7 + "ChatHudMixin", 8 8 "ChatInputSuggestorMixin", 9 9 "ChatScreenAccess", 10 10 "ChatScreenMixin", ··· 15 15 }, 16 16 "overwrites": { 17 17 "requireAnnotations": true 18 - }, 19 - "mixins": [ 20 - "SimpleDefaultedRegistryMixin" 21 - ] 18 + } 22 19 }
+15 -6
project/hexic/src/client/scala/org/eu/net/pool/hexic/client/main.scala
··· 36 36 import net.minecraft.registry.{MutableRegistry, Registries, RegistryKeys, RegistryWrapper} 37 37 import net.minecraft.screen.slot.Slot 38 38 import net.minecraft.text.{CharacterVisitor, OrderedText, Style} 39 - import net.minecraft.util.DyeColor 39 + import net.minecraft.util.{DyeColor, Identifier} 40 40 import net.minecraft.util.collection.DefaultedList 41 41 import net.minecraft.util.math.{Direction, MathHelper, Vec3d} 42 - import org.eu.net.pool.hexic.mixin.client.ChatScreenAccess 43 42 44 43 import java.io.{InputStreamReader, Reader} 45 44 import java.util.function.Consumer ··· 50 49 import scala.util.boundary 51 50 import scala.util.boundary.Label 52 51 import scala.util.chaining.scalaUtilChainingOps 53 - 54 - import phlib.{_, given} 52 + import phlib.{*, given} 55 53 56 54 given client: MinecraftClient = MinecraftClient.getInstance 57 55 ··· 59 57 client.player match 60 58 case null => default 61 59 case player => ifPresent(player) 62 - 63 - var lastMurmur: Option[String] = None 64 60 65 61 object Hooks: 66 62 def provideRenderText(string: String, firstCharacterIndex: Int, field: TextFieldWidget, original: OrderedText): OrderedText = ··· 136 132 val k = s"layer$i" 137 133 if !json.ItemModelGenerator.LAYERS.contains(k) then 138 134 json.ItemModelGenerator.LAYERS.add(k) 135 + phlib.Events.registryLookup.register: 136 + val preferredColor = DyeColor.values()(client.getSession.getUuidOrNull.getLeastSignificantBits.abs.%(16).toInt) 137 + val preferredStringworm = stringworms(Stringworm.flavors(client.getSession.getUuidOrNull.getLeastSignificantBits.abs.%(48).*(7).%(4).toInt)) 138 + val preferredMediaweave = Mediaweave.colors(preferredColor) 139 + val preferredPen = Pen(preferredColor) 140 + val preferredPouch = memo(MediaBundle(preferredColor, _)) 141 + { 142 + case (Registries.ITEM, id) if id == ("preferred_mediaweave": Identifier) => preferredMediaweave 143 + case (Registries.ITEM, id) if id == ("small_preferred_bundle": Identifier) => preferredPouch(6) 144 + case (Registries.ITEM, id) if id == ("large_preferred_bundle": Identifier) => preferredPouch(12) 145 + case (Registries.ITEM, id) if id == ("preferred_stringworm": Identifier) => preferredStringworm 146 + case (Registries.ITEM, id) if id == ("preferred_pen": Identifier) => preferredPen 147 + } 139 148 ClientPlayNetworking.registerGlobalReceiver("msg", (_, handler, buf, _) => 140 149 val s = buf.readString 141 150 if s.startsWith("/") then
-67
project/hexic/src/client/scala/org/eu/net/pool/hexic/mixin/client/SimpleDefaultedRegistryMixin.java
··· 1 - package org.eu.net.pool.hexic.mixin.client; 2 - 3 - import net.minecraft.client.MinecraftClient; 4 - import net.minecraft.item.Item; 5 - import net.minecraft.registry.SimpleDefaultedRegistry; 6 - import net.minecraft.util.DyeColor; 7 - import net.minecraft.util.Identifier; 8 - import org.eu.net.pool.hexic.*; 9 - import org.jetbrains.annotations.Nullable; 10 - import org.spongepowered.asm.mixin.Mixin; 11 - import org.spongepowered.asm.mixin.injection.At; 12 - import org.spongepowered.asm.mixin.injection.Inject; 13 - import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; 14 - 15 - import java.util.Optional; 16 - 17 - @Mixin(SimpleDefaultedRegistry.class) 18 - public class SimpleDefaultedRegistryMixin { 19 - private DyeColor hexic$preferred() { 20 - long n = MinecraftClient.getInstance().getSession().getUuidOrNull().getLeastSignificantBits(); 21 - n %= 16; 22 - if (n < 0) n += 16; 23 - return DyeColor.values()[(int) n]; 24 - } 25 - 26 - private Mediaweave hexic$preferredMediaweave() { 27 - return Mediaweave$.MODULE$.colors().apply(hexic$preferred()); 28 - } 29 - private MediaBundle hexic$preferredBundle(int size) { 30 - return MediaBundle.apply(hexic$preferred(), size); 31 - } 32 - private Pen hexic$preferredPen() { 33 - return Pen.apply(hexic$preferred()); 34 - } 35 - 36 - private Item hexic$preferredStringworm() { 37 - long n = MinecraftClient.getInstance().getSession().getUuidOrNull().getLeastSignificantBits(); 38 - n %= 48; 39 - n *= 7; 40 - n %= 4; 41 - if (n < 0) n += 4; 42 - return Extern.getStringworm((int) n); 43 - } 44 - 45 - @Inject(method = "get(Lnet/minecraft/util/Identifier;)Ljava/lang/Object;", at = @At("HEAD"), cancellable = true) 46 - void getHook(@Nullable Identifier par1, CallbackInfoReturnable cir) { 47 - if (par1 != null && par1.getNamespace().equals("hexic") && par1.getPath().equals("preferred_mediaweave")) cir.setReturnValue(hexic$preferredMediaweave()); 48 - if (par1 != null && par1.getNamespace().equals("hexic") && par1.getPath().equals("small_preferred_bundle")) cir.setReturnValue(hexic$preferredBundle(6)); 49 - if (par1 != null && par1.getNamespace().equals("hexic") && par1.getPath().equals("large_preferred_bundle")) cir.setReturnValue(hexic$preferredBundle(12)); 50 - if (par1 != null && par1.getNamespace().equals("hexic") && par1.getPath().equals("preferred_stringworm")) cir.setReturnValue(hexic$preferredStringworm()); 51 - if (par1 != null && par1.getNamespace().equals("hexic") && par1.getPath().equals("preferred_pen")) cir.setReturnValue(hexic$preferredPen()); 52 - } 53 - 54 - @Inject(method = "getOrEmpty", at = @At("HEAD"), cancellable = true) 55 - void getOrEmptyHook(@Nullable Identifier id, CallbackInfoReturnable<Optional> cir) { 56 - if (id != null && id.getNamespace().equals("hexic") && id.getPath().equals("preferred_mediaweave")) 57 - cir.setReturnValue(Optional.of(hexic$preferredMediaweave())); 58 - if (id != null && id.getNamespace().equals("hexic") && id.getPath().equals("small_preferred_bundle")) 59 - cir.setReturnValue(Optional.of(hexic$preferredBundle(6))); 60 - if (id != null && id.getNamespace().equals("hexic") && id.getPath().equals("large_preferred_bundle")) 61 - cir.setReturnValue(Optional.of(hexic$preferredBundle(12))); 62 - if (id != null && id.getNamespace().equals("hexic") && id.getPath().equals("preferred_stringworm")) 63 - cir.setReturnValue(Optional.of(hexic$preferredStringworm())); 64 - if (id != null && id.getNamespace().equals("hexic") && id.getPath().equals("preferred_pen")) 65 - cir.setReturnValue(Optional.of(hexic$preferredPen())); 66 - } 67 - }
-3
shell.nix
··· 1 1 { 2 2 pkgs ? import (fetchTarball "https://github.com/nixos/nixpkgs/archive/fe51d34885f7b5e3e7b59572796e1bcb427eccb1.tar.gz") { config.allowUnfree = true; }, 3 3 nixGL ? import (fetchTarball "https://github.com/nix-community/nixGL/archive/310f8e49a149e4c9ea52f1adf70cdc768ec53f8a.tar.gz") { inherit pkgs; }, 4 - jj ? (builtins.getFlake github:jj-vcs/jj/1f49e52d42dac25d136110b09232917e63bed9ea), 5 4 }: 6 5 7 6 pkgs.mkShell { ··· 24 23 pkgs.go 25 24 pkgs.gradle_8 26 25 pkgs.imagemagick 27 - pkgs.jujutsu 28 26 pkgs.zulu17 29 27 pkgs.zulu21 30 - jj.packages.${pkgs.system}.default 31 28 ] ++ (if pkgs.system == "x86_64-linux" then [ 32 29 nixGL.auto.nixGLDefault 33 30 pkgs.jetbrains.idea-community