tangled
alpha
login
or
join now
codexarchonic.nekoweb.org
/
ProjectInfinity
0
fork
atom
Inspired by 2020's April Fools' 20w14infinite Snapshot, this mod brings endless randomly generated dimensions into Minecraft.
0
fork
atom
overview
issues
6
pulls
pipelines
removing unused deprecated code; minor irid tweaks
Lera
7 months ago
aaa08a9e
3eaf3029
+5
-79
6 changed files
expand all
collapse all
unified
split
common
src
main
java
net
lerariemann
infinity
iridescence
Iridescence.java
mixin
iridescence
LandPathNodeMakerMixin.java
options
InfinityOptions.java
IridescentMap.java
registry
core
ModItemFunctions.java
resources
config
easter
credits.json
+2
-2
common/src/main/java/net/lerariemann/infinity/iridescence/Iridescence.java
reviewed
···
115
115
StatusEffectInstance cooldown = entity.getStatusEffect(ModStatusEffects.IRIDESCENT_COOLDOWN);
116
116
if (cooldown == null) return original;
117
117
else if (cooldown.getAmplifier() < 1) {
118
118
-
if (original > 0) return 0;
118
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
138
-
return ticksInHour * (3 + amplifier);
138
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
reviewed
···
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
26
-
if (mob != null && Iridescence.isIridescence(entity.getWorld(), new BlockPos(x, y, z))) {
26
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
reviewed
···
23
23
public NbtCompound data;
24
24
public PitchShifter shifter;
25
25
public EffectGiver effect;
26
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
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
reviewed
···
1
1
-
package net.lerariemann.infinity.options;
2
2
-
3
3
-
import net.lerariemann.infinity.util.InfinityMethods;
4
4
-
import net.lerariemann.infinity.util.core.NbtUtils;
5
5
-
import net.minecraft.nbt.NbtCompound;
6
6
-
import net.minecraft.util.math.BlockPos;
7
7
-
8
8
-
import java.util.Random;
9
9
-
10
10
-
import static net.lerariemann.infinity.block.custom.IridescentBlock.num_models;
11
11
-
12
12
-
@Deprecated
13
13
-
public interface IridescentMap {
14
14
-
default int getColor(BlockPos pos) {
15
15
-
return InfinityMethods.properMod((int)(num_models * getHue(pos)), num_models);
16
16
-
}
17
17
-
default double getHue(BlockPos pos) {
18
18
-
return InfinityMethods.sample(pos);
19
19
-
}
20
20
-
21
21
-
static IridescentMap decode(NbtCompound data) {
22
22
-
if (!data.contains("type")) return Perliny.INSTANCE;
23
23
-
return switch (NbtUtils.getString(data,"type", "")) {
24
24
-
case "linear" -> Linear.INSTANCE;
25
25
-
case "circles" -> new PrettyCircles(NbtUtils.getFloat(data, "scale", num_models / 2.0f));
26
26
-
case "static" -> new Static(NbtUtils.getInt(data, "value", 0));
27
27
-
case "random" -> RandomMap.INSTANCE;
28
28
-
default -> Perliny.INSTANCE;
29
29
-
};
30
30
-
}
31
31
-
32
32
-
enum Perliny implements IridescentMap {
33
33
-
INSTANCE
34
34
-
}
35
35
-
enum Linear implements IridescentMap {
36
36
-
INSTANCE;
37
37
-
@Override
38
38
-
public int getColor(BlockPos pos) {
39
39
-
return InfinityMethods.properMod(pos.getX() + pos.getY() + pos.getZ(), num_models);
40
40
-
}
41
41
-
}
42
42
-
enum RandomMap implements IridescentMap {
43
43
-
INSTANCE;
44
44
-
@Override
45
45
-
public int getColor(BlockPos pos) {
46
46
-
return (new Random(pos.hashCode())).nextInt(num_models);
47
47
-
}
48
48
-
}
49
49
-
record PrettyCircles(double scale) implements IridescentMap {
50
50
-
@Override
51
51
-
public double getHue(BlockPos pos) {
52
52
-
return (Math.cos(pos.getX()/scale) + Math.cos(pos.getY()/scale) + Math.cos(pos.getZ()/scale))/4;
53
53
-
}
54
54
-
}
55
55
-
record Static(int value) implements IridescentMap {
56
56
-
@Override
57
57
-
public int getColor(BlockPos pos) {
58
58
-
return InfinityMethods.properMod(value, num_models);
59
59
-
}
60
60
-
}
61
61
-
}
-11
common/src/main/java/net/lerariemann/infinity/registry/core/ModItemFunctions.java
reviewed
···
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
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
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
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
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
125
-
}
126
126
-
127
127
-
@Deprecated
128
128
-
@Environment(EnvType.CLIENT)
129
129
-
public static float iridPredicate(@Nullable ItemStack stack, ClientWorld world, @Nullable LivingEntity entity, int seed) {
130
130
-
if (entity == null) return 0;
131
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
reviewed
···
1
1
{
2
2
-
"infinity_version": 2005000,
2
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
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
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": {