repo for my hex addons :3
0
fork

Configure Feed

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

stringworms

+32 -15
+1
project/hexic/changelog
··· 15 15 2.0.0 add view iotas (experimental!) 16 16 2.0.0 fix getting kicked if mediaweave sends an overly long message 17 17 2.0.0 load config from config/*.properties instead of config/jvm.properties 18 + 2.0.0 made stringworms obtainable 18 19 2.0.0 mediaweave now applies to all chat messages 19 20 2.0.0 !mediaweave now uses trinket slots 20 21 2.0.0 murmur and reveal now use separate components
+1 -1
project/hexic/src/main/resources/assets/hexcasting/patchouli_books/thehexbook/en_us/entries/addon/hexic/stringworms.json
··· 4 4 "advancement": "hexcasting:root", 5 5 "icon": "hexic:preferred_stringworm", 6 6 "pages": [ 7 - "A strange object I've discovered, stringworms are worm imitations made from fuzz. I'd imagine some people would have fun playing with them, but they have no use in my studies." 7 + "A strange object I've discovered, stringworms are worm imitations made from fuzz. I can acquire a stringworm by edifying placed String; however, they have no use in my studies." 8 8 ] 9 9 }
+6 -3
project/hexic/src/main/scala/org/eu/net/pool/hexic/main.scala
··· 691 691 private def showMedia(tag: String, media: Long, maxMedia: Long) = Text.translatable("hexic.media.finite", Text.translatable(s"hexic.media.$tag"), dustAmount(media).styled(_.withColor(ItemMediaHolder.HEX_COLOR)), Text.translatable("hexcasting.tooltip.media", dustAmount(maxMedia)).styled(_.withColor(ItemMediaHolder.HEX_COLOR)), Text.literal(PERCENTAGE.format(100.0 * media / maxMedia)+"%").styled(_.withColor(MediaHelper.mediaBarColor(media, maxMedia)))) 692 692 private def dustAmount(media: Long) = Text.literal(DUST_AMOUNT.format(media / MediaConstants.DUST_UNIT.toDouble)) 693 693 694 + extension [T] (s: => Seq[T]) def *^(n: Int) = Seq.fill(n)(()).flatMap((_) => s) 694 695 class Stringworm extends Item(Stringworm.settings) 695 696 object Stringworm: 696 697 val settings = Item.Settings().maxCount(16) 697 698 val flavors = Seq("pure", "action", "hex", "media", "thing") 698 - 699 - val stringworms = 700 - Stringworm.flavors.map(_ -> new Stringworm).toMap 699 + val biasedFlavors = "pure" +: Seq("action", "hex", "media", "thing") *^ 3 700 + def randomFlavor(using rng: net.minecraft.util.math.random.Random) = items(biasedFlavors(rng.nextInt(biasedFlavors.size))) 701 + val items = 702 + Stringworm.flavors.map(_ -> new Stringworm).toMap 703 + export Stringworm.items as stringworms 701 704 702 705 object dyedStringworm extends Stringworm: 703 706 override def getName(stack: ItemStack): Text =
+24 -11
project/hexic/src/main/scala/org/eu/net/pool/hexic/mixin/OpEdifySaplingMixin.java
··· 22 22 import net.minecraft.util.DyeColor; 23 23 import net.minecraft.util.math.BlockPos; 24 24 import org.eu.net.pool.hexic.Mediaweave$; 25 + import org.eu.net.pool.hexic.Stringworm; 25 26 import org.eu.net.pool.hexic.duck.OpEdifySapling$SpellAccess; 26 27 import org.spongepowered.asm.mixin.Final; 27 28 import org.spongepowered.asm.mixin.Mixin; ··· 45 46 } 46 47 if (original.call(instance, BlockTags.WOOL_CARPETS)) { 47 48 mediaweave.set(2); 49 + return true; 50 + } 51 + if (instance.isOf(Blocks.TRIPWIRE)) { 52 + mediaweave.set(-1); 48 53 return true; 49 54 } 50 55 return false; ··· 71 76 @Inject(method = "cast(Lat/petrak/hexcasting/api/casting/eval/CastingEnvironment;)V", at = @At("HEAD"), cancellable = true) 72 77 void preCast(CastingEnvironment env, CallbackInfo ci) { 73 78 if (hexic$mediaweave != 0) { 74 - BlockState state = env.getWorld().getBlockState(pos); 75 - String id = Registries.BLOCK.getId(state.getBlock()).getPath(); 76 - for (DyeColor color: DyeColor.values()) { 77 - if (id.startsWith(color.asString())) { 78 - int count = Math.max( 79 - env.getWorld().getRandom().nextBetween(hexic$mediaweave, hexic$mediaweave * 3), 80 - env.getWorld().getRandom().nextBetween(hexic$mediaweave, hexic$mediaweave * 2) 81 - ); 82 - env.getWorld().setBlockState(pos, Blocks.AIR.getDefaultState()); 83 - Block.dropStack(env.getWorld(), pos, new ItemStack(Mediaweave$.MODULE$.colors().apply(color), count)); 84 - ci.cancel(); 79 + ItemStack droppedStack; 80 + a: if (hexic$mediaweave == -1) { 81 + droppedStack = new ItemStack(Stringworm.randomFlavor(env.getWorld().getRandom())); 82 + } else { 83 + BlockState state = env.getWorld().getBlockState(pos); 84 + String id = Registries.BLOCK.getId(state.getBlock()).getPath(); 85 + for (DyeColor color : DyeColor.values()) { 86 + if (id.startsWith(color.asString())) { 87 + int count = Math.max( 88 + env.getWorld().getRandom().nextBetween(hexic$mediaweave, hexic$mediaweave * 3), 89 + env.getWorld().getRandom().nextBetween(hexic$mediaweave, hexic$mediaweave * 2) 90 + ); 91 + droppedStack = new ItemStack(Mediaweave$.MODULE$.colors().apply(color), count); 92 + break a; 93 + } 85 94 } 95 + return; 86 96 } 97 + env.getWorld().setBlockState(pos, Blocks.AIR.getDefaultState()); 98 + Block.dropStack(env.getWorld(), pos, droppedStack); 99 + ci.cancel(); 87 100 } 88 101 } 89 102 }