Inspired by 2020's April Fools' 20w14infinite Snapshot, this mod brings endless randomly generated dimensions into Minecraft.

removing unused deprecated code; minor irid tweaks

Lera aaa08a9e 3eaf3029

+5 -79
+2 -2
common/src/main/java/net/lerariemann/infinity/iridescence/Iridescence.java
··· 115 115 StatusEffectInstance cooldown = entity.getStatusEffect(ModStatusEffects.IRIDESCENT_COOLDOWN); 116 116 if (cooldown == null) return original; 117 117 else if (cooldown.getAmplifier() < 1) { 118 - if (original > 0) return 0; 118 + if (original > 0) return original / 2; 119 119 } 120 120 return -1; 121 121 } ··· 135 135 return ticksInHour; 136 136 } 137 137 static int getPeakLength(int amplifier) { 138 - return ticksInHour * (3 + amplifier); 138 + return ticksInHour * (4 + amplifier); 139 139 } 140 140 static int getOffsetLength(int amplifier) { 141 141 return ticksInHour * (4 + amplifier) / 2;
+1 -1
common/src/main/java/net/lerariemann/infinity/mixin/iridescence/LandPathNodeMakerMixin.java
··· 23 23 @Inject(method = "getNodeType(Lnet/minecraft/entity/ai/pathing/PathContext;IIILnet/minecraft/entity/mob/MobEntity;)Lnet/minecraft/entity/ai/pathing/PathNodeType;", 24 24 at = @At("HEAD"), cancellable = true) 25 25 private void inj(PathContext context, int x, int y, int z, MobEntity mob, CallbackInfoReturnable<PathNodeType> cir) { 26 - if (mob != null && Iridescence.isIridescence(entity.getWorld(), new BlockPos(x, y, z))) { 26 + if (mob != null && entity != null && Iridescence.isIridescence(entity.getWorld(), new BlockPos(x, y, z))) { 27 27 if (entity instanceof AbstractChessFigure figure && figure.isBlackOrWhite()) 28 28 cir.setReturnValue(PathNodeType.BLOCKED); 29 29 }
-2
common/src/main/java/net/lerariemann/infinity/options/InfinityOptions.java
··· 23 23 public NbtCompound data; 24 24 public PitchShifter shifter; 25 25 public EffectGiver effect; 26 - public IridescentMap iridMap; 27 26 28 27 private final double mavity; 29 28 private final double timeScale; ··· 33 32 this.data = data; 34 33 this.shifter = PitchShifter.decode(NbtUtils.getCompound(data, "pitch_shift", new NbtCompound())); 35 34 this.effect = EffectGiver.of(NbtUtils.getCompound(data, "effect", new NbtCompound())); 36 - this.iridMap = IridescentMap.decode(NbtUtils.getCompound(data, "iridescent_map", new NbtCompound())); 37 35 this.mavity = NbtUtils.getDouble(data, "mavity", 1.0); 38 36 this.timeScale = NbtUtils.getDouble(data, "time_scale", 1.0); 39 37 this.haunted = NbtUtils.getBoolean(data, "haunted", false);
-61
common/src/main/java/net/lerariemann/infinity/options/IridescentMap.java
··· 1 - package net.lerariemann.infinity.options; 2 - 3 - import net.lerariemann.infinity.util.InfinityMethods; 4 - import net.lerariemann.infinity.util.core.NbtUtils; 5 - import net.minecraft.nbt.NbtCompound; 6 - import net.minecraft.util.math.BlockPos; 7 - 8 - import java.util.Random; 9 - 10 - import static net.lerariemann.infinity.block.custom.IridescentBlock.num_models; 11 - 12 - @Deprecated 13 - public interface IridescentMap { 14 - default int getColor(BlockPos pos) { 15 - return InfinityMethods.properMod((int)(num_models * getHue(pos)), num_models); 16 - } 17 - default double getHue(BlockPos pos) { 18 - return InfinityMethods.sample(pos); 19 - } 20 - 21 - static IridescentMap decode(NbtCompound data) { 22 - if (!data.contains("type")) return Perliny.INSTANCE; 23 - return switch (NbtUtils.getString(data,"type", "")) { 24 - case "linear" -> Linear.INSTANCE; 25 - case "circles" -> new PrettyCircles(NbtUtils.getFloat(data, "scale", num_models / 2.0f)); 26 - case "static" -> new Static(NbtUtils.getInt(data, "value", 0)); 27 - case "random" -> RandomMap.INSTANCE; 28 - default -> Perliny.INSTANCE; 29 - }; 30 - } 31 - 32 - enum Perliny implements IridescentMap { 33 - INSTANCE 34 - } 35 - enum Linear implements IridescentMap { 36 - INSTANCE; 37 - @Override 38 - public int getColor(BlockPos pos) { 39 - return InfinityMethods.properMod(pos.getX() + pos.getY() + pos.getZ(), num_models); 40 - } 41 - } 42 - enum RandomMap implements IridescentMap { 43 - INSTANCE; 44 - @Override 45 - public int getColor(BlockPos pos) { 46 - return (new Random(pos.hashCode())).nextInt(num_models); 47 - } 48 - } 49 - record PrettyCircles(double scale) implements IridescentMap { 50 - @Override 51 - public double getHue(BlockPos pos) { 52 - return (Math.cos(pos.getX()/scale) + Math.cos(pos.getY()/scale) + Math.cos(pos.getZ()/scale))/4; 53 - } 54 - } 55 - record Static(int value) implements IridescentMap { 56 - @Override 57 - public int getColor(BlockPos pos) { 58 - return InfinityMethods.properMod(value, num_models); 59 - } 60 - } 61 - }
-11
common/src/main/java/net/lerariemann/infinity/registry/core/ModItemFunctions.java
··· 7 7 import net.fabricmc.api.Environment; 8 8 import net.lerariemann.infinity.block.custom.BiomeBottleBlock; 9 9 import net.lerariemann.infinity.item.function.*; 10 - import net.lerariemann.infinity.options.InfinityOptions; 11 10 import net.lerariemann.infinity.util.InfinityMethods; 12 11 import net.minecraft.block.DispenserBlock; 13 12 import net.minecraft.block.dispenser.ItemDispenserBehavior; 14 - import net.minecraft.client.world.ClientWorld; 15 13 import net.minecraft.component.ComponentChanges; 16 14 import net.minecraft.entity.Entity; 17 15 import net.minecraft.entity.ItemEntity; 18 - import net.minecraft.entity.LivingEntity; 19 16 import net.minecraft.item.FluidModificationItem; 20 17 import net.minecraft.item.Item; 21 18 import net.minecraft.item.ItemStack; ··· 33 30 import net.minecraft.util.math.BlockPos; 34 31 import net.minecraft.util.math.Vec3d; 35 32 import net.minecraft.world.World; 36 - import org.jetbrains.annotations.Nullable; 37 33 38 34 import java.util.Optional; 39 35 import java.util.function.Function; ··· 122 118 -v.x, -v.y, -v.z); 123 119 w.spawnEntity(result); 124 120 itemEntity.remove(Entity.RemovalReason.CHANGED_DIMENSION); 125 - } 126 - 127 - @Deprecated 128 - @Environment(EnvType.CLIENT) 129 - public static float iridPredicate(@Nullable ItemStack stack, ClientWorld world, @Nullable LivingEntity entity, int seed) { 130 - if (entity == null) return 0; 131 - return (InfinityOptions.access(world).iridMap.getColor(entity.getBlockPos()) / 100.0f); 132 121 } 133 122 134 123 @Environment(EnvType.CLIENT)
+2 -2
common/src/main/resources/config/easter/credits.json
··· 1 1 { 2 - "infinity_version": 2005000, 2 + "infinity_version": 2005001, 3 3 "options": { 4 4 "portal_color": 11894492 5 5 }, ··· 73 73 "then_run": { 74 74 "type": "minecraft:condition", 75 75 "if_true": { 76 - "text": "Acknowledgements$n----------------------$nMod by LeraRiemann, cassiancc$n$nMusic by ivory rosewood$n$nAdditional code by:$n* BasiqueEvangelist$n* unilock$n$nAlpha testers:$n* MamonaTheGreed$n* Mirakuzura$n* sweetbriar$n$nGolden bug catcher:$n* JustImagineIT$n$nBug catchers:$n* ezioishere$n* MommysDebitCard$n* 0tvechau$n* purplenathaniel$n* bravely-beep$n* tylerb153$n* Lord_Drakostar$n* slomas04$n* Strike_GR$n* TVFLabs$n* krispyking24$n* wknowleskellett$n* CrownScorpion$n* CraftyZombie$n* Pookette$n* anhonestheart$n* hollow_egg$n* zontreck$n* erasemint$n* EssGeeEich$n* CryptidArtha$n* general-chat$n* FrostedGeulleisia$n* LamarTheGH$n* oceansodaz----------------------$nMay contain elephants", 76 + "text": "Acknowledgements$n----------------------$nMod by LeraRiemann, cassiancc$n$nMusic by ivory rosewood$n$nAdditional code by:$n* BasiqueEvangelist$n* unilock$n$nAlpha testers:$n* MamonaTheGreed$n* Mirakuzura$n* sweetbriar$n$nGolden bug catcher:$n* JustImagineIT$n$nBug catchers:$n* ezioishere$n* MommysDebitCard$n* 0tvechau$n* purplenathaniel$n* bravely-beep$n* tylerb153$n* Lord_Drakostar$n* slomas04$n* Strike_GR$n* TVFLabs$n* krispyking24$n* wknowleskellett$n* CrownScorpion$n* CraftyZombie$n* Pookette$n* anhonestheart$n* hollow_egg$n* zontreck$n* erasemint$n* EssGeeEich$n* CryptidArtha$n* general-chat$n* FrostedGeulleisia$n* LamarTheGH$n* oceansodaz$n* Dorian4771----------------------$nMay contain elephants", 77 77 "type": "infinity:text" 78 78 }, 79 79 "then_run": {