Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/generated/resources/.cache/4d58d921702f57799841730d3d537abc5ea398a2
#	src/main/java/com/portingdeadmods/nautec/content/menus/BacterialAnalyzerMenu.java
  • Loading branch information
Thepigcat76 committed Dec 20, 2024
2 parents 08ec792 + 4540d92 commit d38a486
Show file tree
Hide file tree
Showing 22 changed files with 334 additions and 42 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// 1.21.1 2024-12-16T23:03:28.632599872 Registries
81ae891c9f56e166f6748e3ee80edccaf52a3c73 data/nautec/nautec/bacteria/cyanobacteria.json
895816a71ba92ab2662725824d004e3c1a462196 data/nautec/nautec/bacteria/empty.json
ed5540fa74500b1db6f27d6c30eeac50ee4f8f9c data/nautec/nautec/bacteria/halobacteria.json
24a515c8c46fbb92431a9aad10ae4c8684ed142f data/nautec/nautec/bacteria/methanogens.json
5d152052e74ab6e5dc7a780c1e2af000469b6e6d data/nautec/nautec/bacteria/thermophiles.json
// 1.21.1 2024-12-19T15:16:06.7633778 Registries
4cc74761a420946768852a3c4e5fba64de831555 data/nautec/nautec/bacteria/cyanobacteria.json
2ceb7d9533a35c6cb05ba68915ecaf868def152a data/nautec/nautec/bacteria/empty.json
ce644e1811997ff67d2f7df856532017272a7b22 data/nautec/nautec/bacteria/halobacteria.json
36808ce13b558579e40af12e305adf733c501003 data/nautec/nautec/bacteria/methanogens.json
165e8d4b95ee84a6c951b35561ba6808bf60c49c data/nautec/nautec/bacteria/thermophiles.json
d3949aab832fc1b72c2512c35586c2682dea4d4d data/nautec/worldgen/configured_feature/prismarine_sand_beach.json
e9f0c0ce377bc6f731c3b36673e845152a53327d data/nautec/worldgen/configured_feature/prismarine_sand_ocean.json
685d14b2486e0da05c931e69fe78236dd9523cbf data/nautec/worldgen/placed_feature/prismarine_sand_beach.json
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// 1.21.1 2024-12-16T22:58:24.975013206 Recipes
// 1.21.1 2024-12-19T15:16:06.7611986 Recipes
ebae64ded4bb31c5b0cf21d6f4a5df5c4bce9ab0 data/nautec/advancement/recipes/building_blocks/brown_polymer_block.json
056382c183d52a8f0d17b4992017b217f7444060 data/nautec/advancement/recipes/building_blocks/brown_polymer_from_block.json
e1102abc52970c4638811a9f3aed423c343b2976 data/nautec/advancement/recipes/building_blocks/chiseled_dark_prismarine.json
Expand Down Expand Up @@ -44,9 +44,9 @@ e8c7d011fc8d7584ae12c127a368e794c349cc43 data/nautec/advancement/recipes/misc/la
5a63e821107905c4834ef94b9dda1d99041e5cc0 data/nautec/advancement/recipes/misc/long_distance_laser.json
fa6493a3ef0380850872951ce297171d1708ce63 data/nautec/advancement/recipes/misc/mixer.json
94885315f77dd2362883172287de15e80f1a6e7b data/nautec/advancement/recipes/misc/nautec_guide.json
8b0963164bc58a64ef675d369ac6f4221b8cbebb data/nautec/advancement/recipes/misc/prism_monocle.json
002f4581bd2e95a74b869395702f7a95e2b2c5f5 data/nautec/advancement/recipes/misc/prismarine_relay.json
1eb85648ed5c154f0a465c787ef1cfd4542c3572 data/nautec/advancement/recipes/misc/prismatic_battery.json
8b0963164bc58a64ef675d369ac6f4221b8cbebb data/nautec/advancement/recipes/misc/prism_monocle.json
df1f62063c751d0d6939426505f6bb14f6ae7382 data/nautec/advancement/recipes/misc/whisk.json
83490bc77ed0236455b903949d3ef5ee0430d7ed data/nautec/recipe/aquarine_axe.json
2705880f2aec0f82cf5d58ffa1736dbeea7b7452 data/nautec/recipe/aquarine_boots.json
Expand Down Expand Up @@ -106,8 +106,8 @@ a4bdb97abe0834d405f7584452f78242585e02ff data/nautec/recipe/laser_channeling_coi
4925f952a200ae56a4e1ad04a45897be4988aad4 data/nautec/recipe/mixer.json
674df651148d747a200794f496996b82ca94e72f data/nautec/recipe/nautec_guide.json
f9596d9be4a76ba5e91496e7396018daa20cccfc data/nautec/recipe/polished_prismarine.json
4fe8f6115c759c654e132afedec76d846f0a89d5 data/nautec/recipe/prism_monocle.json
ac628b97c097227e3af94f13cbe35a2cf3ee3124 data/nautec/recipe/prismarine_relay.json
4745c9855337a311cb5b7211168927a61645d193 data/nautec/recipe/prismatic_battery.json
4fe8f6115c759c654e132afedec76d846f0a89d5 data/nautec/recipe/prism_monocle.json
0e781b8c85808d8ee2691a5c39404da2b6a8f061 data/nautec/recipe/valve.json
266c89a0698de108847ad3b60be50d230822cee4 data/nautec/recipe/whisk.json
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// 1.21.1 2024-12-16T12:56:36.5452448 Languages: en_us
cb59c9cda54c192d94a6d91598a550f3a0a55062 assets/nautec/lang/en_us.json
// 1.21.1 2024-12-19T15:27:30.4978381 Languages: en_us
26ff82214c574807b043b3a8a0cc2117f9429b33 assets/nautec/lang/en_us.json
9 changes: 5 additions & 4 deletions src/generated/resources/assets/nautec/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@
"augment_type.nautec.dolphin_fin": "Dolphin Fin",
"augment_type.nautec.drowned_lung": "Drowned Lung",
"augment_type.nautec.guardian_eye": "Guardian Eye",
"bacteria.nautec.cyanobacteria": "Cyanobacteria / Blue-Green algae",
"bacteria.nautec.empty": "Empty",
"bacteria.nautec.halobacteria": "Halobacteria",
"bacteria.nautec.methanogens": "Methanogens",
"bacteria.nautec.thermophiles": "Thermophiles",
"block.nautec.aquarine_steel_block": "Aquarine Steel Block",
"block.nautec.aquatic_catalyst": "Aquatic Catalyst",
"block.nautec.augmentation_station": "Augmentation Station",
Expand Down Expand Up @@ -228,9 +233,5 @@
"nautec.tool.shovel.ability": "Ability: Mine in a 3x3 Area",
"nautec.tool.status": "Status: ",
"nautec.tool.sword.ability": "Ability: Deal 70% more damage and spawn lightnings at targets",
"nautec:cyanobacteria": "Cyanobacteria",
"nautec:halobacteria": "Halobacteria",
"nautec:methanogens": "Methanogens",
"nautec:thermophiles": "Thermophiles",
"nautec_guide.desc.0": "Nautec's Guide"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"parent": "nautec:block/breaker"
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"type": "nautec:simple",
"stats": {
"colony_size": 0.0,
"color": -13434881,
"growth_rate": 0.0,
"lifespan": 0,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"type": "nautec:simple",
"stats": {
"colony_size": 0.0,
"color": 0,
"growth_rate": 0.0,
"lifespan": 0,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"type": "nautec:simple",
"stats": {
"colony_size": 0.0,
"color": -6912,
"growth_rate": 0.0,
"lifespan": 0,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"type": "nautec:simple",
"stats": {
"colony_size": 0.0,
"color": -1328403,
"growth_rate": 0.0,
"lifespan": 0,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"type": "nautec:simple",
"stats": {
"colony_size": 0.0,
"color": -65536,
"growth_rate": 0.0,
"lifespan": 0,
Expand Down
34 changes: 34 additions & 0 deletions src/main/java/com/portingdeadmods/nautec/NTConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,27 @@ public final class NTConfig {
.comment("The y depth the fisher checks for water")
.defineInRange("fisherDepth", 2, 1, Integer.MAX_VALUE);

// Biology
private static final ModConfigSpec.DoubleValue BACTERIA_GROWTH_RATE_CAP = BUILDER
.comment("The maximum rate at which bacteria can grow")
.defineInRange("bacteriaGrowthRateCap", 5, 0, Float.MAX_VALUE);

private static final ModConfigSpec.DoubleValue BACTERIA_PRODUCTION_RATE_CAP = BUILDER
.comment("The maximum rate at which bacteria can produce")
.defineInRange("bacteriaProductionRateCap", 2, 0, Float.MAX_VALUE);

private static final ModConfigSpec.DoubleValue BACTERIA_MUTATION_RESISTANCE_CAP = BUILDER
.comment("The maximum rate at which bacteria can resist mutation")
.defineInRange("bacteriaMutationResistanceCap", 1, 0, Float.MAX_VALUE);

private static final ModConfigSpec.DoubleValue BACTERIA_COLONY_SIZE_CAP = BUILDER
.comment("The maximum size a bacteria colony can grow to")
.defineInRange("bacteriaColonySizeCap", 100d, 0, Float.MAX_VALUE);

private static final ModConfigSpec.IntValue BACTERIA_LIFESPAN_CAP = BUILDER
.comment("The maximum lifespan of a bacteria colony")
.defineInRange("bacteriaLifespanCap", 24000, 0, Integer.MAX_VALUE);

static final ModConfigSpec SPEC = BUILDER.build();

public static int kelpHeight;
Expand All @@ -102,6 +123,13 @@ public final class NTConfig {
public static int fisherRunDuration;
public static int fisherRadius;
public static int fisherDepth;

public static float bacteriaGrowthRateCap;
public static float bacteriaProductionRateCap;
public static float bacteriaMutationResistanceCap;
public static float bacteriaColonySizeCap;
public static int bacteriaLifespanCap;

@SubscribeEvent
static void onLoad(final ModConfigEvent event) {
kelpHeight = KELP_HEIGHT.get();
Expand Down Expand Up @@ -129,6 +157,12 @@ static void onLoad(final ModConfigEvent event) {
fisherRunDuration = FISHER_DURATION.getAsInt();
fisherDepth = FISHER_DEPTH.getAsInt();
fisherRadius = FISHER_RADIUS.getAsInt();

bacteriaGrowthRateCap = (float) BACTERIA_GROWTH_RATE_CAP.getAsDouble();
bacteriaProductionRateCap = (float) BACTERIA_PRODUCTION_RATE_CAP.getAsDouble();
bacteriaMutationResistanceCap = (float) BACTERIA_MUTATION_RESISTANCE_CAP.getAsDouble();
bacteriaColonySizeCap = (float) BACTERIA_COLONY_SIZE_CAP.getAsDouble();
bacteriaLifespanCap = BACTERIA_LIFESPAN_CAP.get();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,22 @@ public interface BaseBacteriaStats {

float productionRate();

float colonySize();

int lifespan();

int color();

List<Component> statsTooltip();

// Mutator
BaseBacteriaStats rollGrowthRate();
BaseBacteriaStats rollMutationResistance();
BaseBacteriaStats rollProductionRate();
BaseBacteriaStats rollLifespan();
BaseBacteriaStats rollStats();

// Incubator
BaseBacteriaStats grow();
BaseBacteriaStats shrink();
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,25 @@
import com.mojang.serialization.Codec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import com.portingdeadmods.nautec.api.bacteria.BaseBacteriaStats;
import com.portingdeadmods.nautec.utils.ComponentUtils;
import com.portingdeadmods.nautec.utils.RNGUtils;
import com.portingdeadmods.nautec.utils.codec.CodecUtils;
import net.minecraft.network.RegistryFriendlyByteBuf;
import net.minecraft.network.chat.Component;
import net.minecraft.network.codec.ByteBufCodecs;
import net.minecraft.network.codec.StreamCodec;
import net.minecraft.world.item.Item;
import net.neoforged.neoforge.network.codec.NeoForgeStreamCodecs;

import static com.portingdeadmods.nautec.NTConfig.*;

import java.util.List;

public record BacteriaStats(Item resource,
float growthRate,
float mutationResistance,
float productionRate,
float colonySize,
int lifespan,
int color) implements BaseBacteriaStats {
public static final Codec<BacteriaStats> CODEC = RecordCodecBuilder.create(
Expand All @@ -24,12 +30,13 @@ public record BacteriaStats(Item resource,
Codec.FLOAT.fieldOf("growth_rate").forGetter(BacteriaStats::growthRate),
Codec.FLOAT.fieldOf("mutation_resistance").forGetter(BacteriaStats::mutationResistance),
Codec.FLOAT.fieldOf("production_rate").forGetter(BacteriaStats::productionRate),
Codec.FLOAT.fieldOf("colony_size").forGetter(BacteriaStats::colonySize),
Codec.INT.fieldOf("lifespan").forGetter(BacteriaStats::lifespan),
Codec.INT.fieldOf("color").forGetter(BacteriaStats::color)
).apply(instance, BacteriaStats::new)
);

public static final StreamCodec<RegistryFriendlyByteBuf, BacteriaStats> STREAM_CODEC = StreamCodec.composite(
public static final StreamCodec<RegistryFriendlyByteBuf, BacteriaStats> STREAM_CODEC = NeoForgeStreamCodecs.composite(
CodecUtils.ITEM_STREAM_CODEC,
BacteriaStats::resource,
ByteBufCodecs.FLOAT,
Expand All @@ -38,6 +45,8 @@ public record BacteriaStats(Item resource,
BacteriaStats::mutationResistance,
ByteBufCodecs.FLOAT,
BacteriaStats::productionRate,
ByteBufCodecs.FLOAT,
BacteriaStats::colonySize,
ByteBufCodecs.INT,
BacteriaStats::lifespan,
ByteBufCodecs.INT,
Expand All @@ -48,8 +57,62 @@ public record BacteriaStats(Item resource,
@Override
public List<Component> statsTooltip() {
return List.of(
Component.literal("Resource: "+resource.getDefaultInstance().getDisplayName().getString()),
Component.literal("Growth Rate: "+growthRate)
ComponentUtils.stringStatShow("Resource", resource.getDefaultInstance().getDisplayName().getString()),
ComponentUtils.countableStatShow("Growth Rate", growthRate, bacteriaGrowthRateCap),
ComponentUtils.countableStatShow("Mutation Resistance", mutationResistance, bacteriaMutationResistanceCap),
ComponentUtils.countableStatShow("Production Rate", productionRate, bacteriaProductionRateCap),
ComponentUtils.countableStatShow("Colony Size", colonySize, bacteriaColonySizeCap),
ComponentUtils.countableStatShow("Lifespan", lifespan, bacteriaLifespanCap)
);
}

@Override
public BaseBacteriaStats rollGrowthRate() {
float newGR = growthRate + (RNGUtils.floatInRangeOf(growthRate) / (10 * (1 + mutationResistance)));
newGR = Math.min(newGR, bacteriaGrowthRateCap);

return new BacteriaStats(resource, newGR, mutationResistance, productionRate, colonySize, lifespan, color);
}

@Override
public BaseBacteriaStats rollMutationResistance() {
float newMR = mutationResistance + RNGUtils.biasedInRange(0, 0.1f, mutationResistance) / 10 * (bacteriaMutationResistanceCap - mutationResistance);

return new BacteriaStats(resource, growthRate, newMR, productionRate, colonySize, lifespan, color);
}

@Override
public BaseBacteriaStats rollProductionRate() {
float newPR = productionRate + RNGUtils.floatInRangeOf(productionRate) / 10 * (1 + mutationResistance);
newPR = Math.min(newPR, bacteriaProductionRateCap);

return new BacteriaStats(resource, growthRate, mutationResistance, newPR, colonySize, lifespan, color);
}

@Override
public BaseBacteriaStats rollLifespan() {
int newLS = lifespan + (int) (RNGUtils.uniformRandInt(-10, 10) / (1 + mutationResistance));
newLS = Math.min(newLS, bacteriaLifespanCap);

return new BacteriaStats(resource, growthRate, mutationResistance, productionRate, colonySize, newLS, color);
}

@Override
public BaseBacteriaStats rollStats() {
return rollGrowthRate().rollMutationResistance().rollProductionRate().rollLifespan();
}

@Override
public BaseBacteriaStats grow() {
float newCS = colonySize + RNGUtils.floatInRangeOf(0, growthRate);
newCS = Math.min(newCS, bacteriaColonySizeCap);

return new BacteriaStats(resource, growthRate, mutationResistance, productionRate, newCS, lifespan, color);
}

@Override
public BaseBacteriaStats shrink() {
float newCS = colonySize - colonySize * RNGUtils.uniformRandFloat(25) - 1;
return new BacteriaStats(resource, growthRate, mutationResistance, productionRate, newCS, lifespan, color);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public static class Builder {
private float growthRate;
private float mutationResistance;
private float productionRate;
private float colonySize;
private int lifespan;
private int color;

Expand All @@ -73,6 +74,11 @@ public Builder productionRate(float productionRate) {
return this;
}

public Builder colonySize(float colonySize) {
this.colonySize = colonySize;
return this;
}

public Builder lifespan(int lifespan) {
this.lifespan = lifespan;
return this;
Expand All @@ -84,7 +90,7 @@ public Builder color(int color) {
}

public Bacteria build(ResourceLocation location) {
return new SimpleBacteria(new BacteriaStats(resource, growthRate, mutationResistance, productionRate, lifespan, color));
return new SimpleBacteria(new BacteriaStats(resource, growthRate, mutationResistance, productionRate, colonySize, lifespan, color));
}
}
}
Loading

0 comments on commit d38a486

Please sign in to comment.