Unicopia/src/main/java/com/minelittlepony/unicopia/diet/Ailment.java
Sollace ad7a7d84c0
New food system:
- Foods fill for different amounts for different races
- Certain foods can no longer be eaten by certain races
- Added food categories for candy, rocks, desserts
- Moved everything to datapacks
2023-12-03 02:39:55 +00:00

22 lines
770 B
Java

package com.minelittlepony.unicopia.diet;
import com.minelittlepony.unicopia.diet.affliction.Affliction;
import com.mojang.serialization.Codec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import net.minecraft.network.PacketByteBuf;
public record Ailment(Affliction effects) {
public static final Ailment EMPTY = new Ailment(Affliction.EMPTY);
public static final Codec<Ailment> CODEC = RecordCodecBuilder.create(instance -> instance.group(
Affliction.CODEC.fieldOf("effects").forGetter(Ailment::effects)
).apply(instance, Ailment::new));
public Ailment(PacketByteBuf buffer) {
this(Affliction.read(buffer));
}
public void toBuffer(PacketByteBuf buffer) {
Affliction.write(buffer, effects);
}
}