Skip to content

Commit

Permalink
添加“脏器”类型。
Browse files Browse the repository at this point in the history
  • Loading branch information
Glyceryl6 committed Aug 20, 2024
1 parent fc6cf7a commit 63e68e8
Showing 1 changed file with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package org.hiedacamellia.whispergrove.content.common.viscera;

import com.mojang.serialization.Codec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import net.minecraft.network.RegistryFriendlyByteBuf;
import net.minecraft.network.codec.ByteBufCodecs;
import net.minecraft.network.codec.StreamCodec;
import net.minecraft.resources.ResourceLocation;

public record Viscera(ResourceLocation name, Double yin, Double yang) {

public static final Codec<Viscera> CODEC = RecordCodecBuilder.create(instance -> instance.group(
ResourceLocation.CODEC.fieldOf("name").forGetter(Viscera::name),
Codec.DOUBLE.fieldOf("yin").forGetter(Viscera::yin),
Codec.DOUBLE.fieldOf("yang").forGetter(Viscera::yang))
.apply(instance, Viscera::new));
public static final StreamCodec<RegistryFriendlyByteBuf, Viscera> STREAM_CODEC = StreamCodec.composite(
ResourceLocation.STREAM_CODEC, Viscera::name,
ByteBufCodecs.DOUBLE, Viscera::yin,
ByteBufCodecs.DOUBLE, Viscera::yang, Viscera::new);

}

0 comments on commit 63e68e8

Please sign in to comment.