-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #436 from ZhuRuoLing/releases/1.20.1
电网电量使用信息同步
- Loading branch information
Showing
3 changed files
with
89 additions
and
37 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
common/src/main/java/dev/dubhe/anvilcraft/api/power/PowerComponentInfo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package dev.dubhe.anvilcraft.api.power; | ||
|
||
import com.mojang.serialization.Codec; | ||
import com.mojang.serialization.codecs.RecordCodecBuilder; | ||
import net.minecraft.core.BlockPos; | ||
|
||
public record PowerComponentInfo( | ||
BlockPos pos, | ||
int consumes, | ||
int produces, | ||
int stores, | ||
int capacity, | ||
int range | ||
) { | ||
public static final Codec<PowerComponentInfo> CODEC = RecordCodecBuilder.create(ins -> ins.group( | ||
BlockPos.CODEC.fieldOf("pos").forGetter(o -> o.pos), | ||
Codec.INT.fieldOf("consumes").forGetter(o -> o.consumes), | ||
Codec.INT.fieldOf("produces").forGetter(o -> o.produces), | ||
Codec.INT.fieldOf("stores").forGetter(o -> o.stores), | ||
Codec.INT.fieldOf("capacity").forGetter(o -> o.capacity), | ||
Codec.INT.fieldOf("range").forGetter(o -> o.range) | ||
).apply(ins, PowerComponentInfo::new)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters