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
  • Loading branch information
Thepigcat76 committed Dec 27, 2024
2 parents eb3f9e3 + 6467ecc commit 55f4de9
Show file tree
Hide file tree
Showing 14 changed files with 396 additions and 183 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// 1.21.1 2024-12-21T13:29:07.948008452 Registries
731c134d2749f365fc9a6d44d8d6e400e77eec49 data/nautec/nautec/bacteria/cyanobacteria.json
// 1.21.1 2024-12-24T18:15:02.5464049 Registries
f1cbe78b749af58e6ab35cfcf0e117e8ff1201fd data/nautec/nautec/bacteria/cyanobacteria.json
6e0101d77b1f0382041425952ff4b8544733f2e2 data/nautec/nautec/bacteria/empty.json
81c72e6a3cfb78f800e627cdad79edbb044de4a1 data/nautec/nautec/bacteria/halobacteria.json
09d49475a6a9fffaf92674fc3f0e4df1f76ea94d data/nautec/nautec/bacteria/methanogens.json
f8693e008a409782cc34263ff0b2c2c61c99a3cc data/nautec/nautec/bacteria/thermophiles.json
8bfd159438fbc05a4170b1682dbb19f13b40c2ce data/nautec/nautec/bacteria/halobacteria.json
7752dbd2acb008e58069226bdc06b45deddec8d8 data/nautec/nautec/bacteria/methanogens.json
89cc03b8955fa19e495528d6f9a47db32f938641 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
Expand Up @@ -4,9 +4,21 @@
"stats": {
"type": "nautec:simple",
"color": -13434881,
"growth_rate": 0.0,
"lifespan": 0,
"mutation_resistance": 0.0,
"production_rate": 10.0
"growth_rate": [
0.5,
1.0
],
"lifespan": [
1200,
2400
],
"mutation_resistance": [
0.0,
0.1
],
"production_rate": [
0.1,
0.5
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,21 @@
"stats": {
"type": "nautec:simple",
"color": -6912,
"growth_rate": 0.0,
"lifespan": 0,
"mutation_resistance": 0.0,
"production_rate": 0.0
"growth_rate": [
0.5,
1.0
],
"lifespan": [
1200,
2400
],
"mutation_resistance": [
0.0,
0.1
],
"production_rate": [
0.1,
0.5
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,21 @@
"stats": {
"type": "nautec:simple",
"color": -1328403,
"growth_rate": 0.0,
"lifespan": 0,
"mutation_resistance": 0.0,
"production_rate": 0.0
"growth_rate": [
0.5,
1.0
],
"lifespan": [
1200,
2400
],
"mutation_resistance": [
0.0,
0.1
],
"production_rate": [
0.1,
0.5
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,21 @@
"stats": {
"type": "nautec:simple",
"color": -65536,
"growth_rate": 0.0,
"lifespan": 0,
"mutation_resistance": 0.0,
"production_rate": 0.0
"growth_rate": [
0.5,
1.0
],
"lifespan": [
1200,
2400
],
"mutation_resistance": [
0.0,
0.1
],
"production_rate": [
0.1,
0.5
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.mojang.serialization.Codec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import com.portingdeadmods.nautec.content.bacteria.CollapsedStats;
import com.portingdeadmods.nautec.content.bacteria.SimpleBacteriaStats;
import com.portingdeadmods.nautec.registries.NTBacterias;
import com.portingdeadmods.nautec.utils.BacteriaHelper;
Expand All @@ -16,21 +17,21 @@ public final class BacteriaInstance {
public static final Codec<BacteriaInstance> CODEC = RecordCodecBuilder.create(instance -> instance.group(
Bacteria.BACTERIA_TYPE_CODEC.fieldOf("bacteria").forGetter(BacteriaInstance::getBacteria),
Codec.LONG.fieldOf("amount").forGetter(BacteriaInstance::getAmount),
BacteriaStats.CODEC.fieldOf("stats").forGetter(BacteriaInstance::getStats)
CollapsedStats.CODEC.fieldOf("stats").forGetter(BacteriaInstance::getStats)
).apply(instance, BacteriaInstance::new));
public static final StreamCodec<RegistryFriendlyByteBuf, BacteriaInstance> STREAM_CODEC = StreamCodec.composite(
Bacteria.BACTERIA_TYPE_STREAM_CODEC,
BacteriaInstance::getBacteria,
ByteBufCodecs.VAR_LONG,
BacteriaInstance::getAmount,
BacteriaStats.STREAM_CODEC,
CollapsedStats.STREAM_CODEC,
BacteriaInstance::getStats,
BacteriaInstance::new
);

private final ResourceKey<Bacteria> bacteria;
private long amount;
private BacteriaStats stats;
private CollapsedStats stats;

public BacteriaInstance(ResourceKey<Bacteria> bacteria, HolderLookup.Provider lookup) {
this(bacteria, 1, BacteriaHelper.getBacteria(lookup, bacteria).initialStats());
Expand All @@ -41,6 +42,12 @@ public BacteriaInstance(ResourceKey<Bacteria> bacteria, BacteriaStats stats) {
}

public BacteriaInstance(ResourceKey<Bacteria> bacteria, long amount, BacteriaStats stats) {
this.bacteria = bacteria;
this.amount = amount;
this.stats = stats.collapse();
}

public BacteriaInstance(ResourceKey<Bacteria> bacteria, long amount, CollapsedStats stats) {
this.bacteria = bacteria;
this.amount = amount;
this.stats = stats;
Expand All @@ -58,11 +65,11 @@ public ResourceKey<Bacteria> getBacteria() {
return bacteria;
}

public void setStats(BacteriaStats stats) {
public void setStats(CollapsedStats stats) {
this.stats = stats;
}

public BacteriaStats getStats() {
public CollapsedStats getStats() {
return this.stats;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.mojang.serialization.Codec;
import com.portingdeadmods.nautec.NTRegistries;
import com.portingdeadmods.nautec.content.bacteria.CollapsedStats;
import net.minecraft.network.RegistryFriendlyByteBuf;
import net.minecraft.network.chat.Component;
import net.minecraft.network.codec.ByteBufCodecs;
Expand All @@ -16,31 +17,17 @@ public interface BacteriaStats {
ByteBufCodecs.registry(NTRegistries.BACTERIA_STATS_SERIALIZER_KEY).dispatch(BacteriaStats::getSerializer, BacteriaStatsSerializer::streamCodec);


float growthRate();
List<Float> growthRate();

float mutationResistance();
List<Float> mutationResistance();

float productionRate();
List<Float> productionRate();

int lifespan();
List<Integer> lifespan();

int color();

BacteriaStats copy();
CollapsedStats collapse();

List<Component> statsTooltip();
List<Component> statsTooltipWithMutatorValues();
int color();

BacteriaStatsSerializer<?> getSerializer();

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

// Incubator
BacteriaStats grow();
BacteriaStats shrink();
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.portingdeadmods.nautec.api.bacteria.BacteriaInstance;
import com.portingdeadmods.nautec.api.bacteria.BacteriaStats;
import com.portingdeadmods.nautec.content.bacteria.CollapsedStats;

import java.util.function.UnaryOperator;

Expand All @@ -12,9 +13,8 @@ public interface IBacteriaStorage {

int getBacteriaSlots();

default void modifyStats(int slot, UnaryOperator<BacteriaStats> statsModifier) {
default void modifyStats(int slot, UnaryOperator<CollapsedStats> statsModifier) {
BacteriaInstance bacteriaInstance = getBacteria(slot);
BacteriaStats newStats = statsModifier.apply(bacteriaInstance.getStats());

CollapsedStats newStats = statsModifier.apply(bacteriaInstance.getStats());
}
}
Loading

0 comments on commit 55f4de9

Please sign in to comment.