-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c300d8d
commit 8ddf3eb
Showing
253 changed files
with
10,743 additions
and
666 deletions.
There are no files selected for viewing
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
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
15 changes: 15 additions & 0 deletions
15
src/main/java/com/github/tartaricacid/touhoulittlemaid/api/backpack/IBackpackData.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,15 @@ | ||
package com.github.tartaricacid.touhoulittlemaid.api.backpack; | ||
|
||
import com.github.tartaricacid.touhoulittlemaid.entity.passive.EntityMaid; | ||
import net.minecraft.nbt.CompoundTag; | ||
import net.minecraft.world.inventory.ContainerData; | ||
|
||
public interface IBackpackData { | ||
ContainerData getDataAccess(); | ||
|
||
void load(CompoundTag tag, EntityMaid maid); | ||
|
||
void save(CompoundTag tag, EntityMaid maid); | ||
|
||
void serverTick(EntityMaid maid); | ||
} |
63 changes: 63 additions & 0 deletions
63
src/main/java/com/github/tartaricacid/touhoulittlemaid/api/backpack/IMaidBackpack.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,63 @@ | ||
package com.github.tartaricacid.touhoulittlemaid.api.backpack; | ||
|
||
import com.github.tartaricacid.touhoulittlemaid.entity.item.EntityTombstone; | ||
import com.github.tartaricacid.touhoulittlemaid.entity.passive.EntityMaid; | ||
import com.github.tartaricacid.touhoulittlemaid.item.BackpackLevel; | ||
import com.github.tartaricacid.touhoulittlemaid.util.ItemsUtil; | ||
import com.mojang.blaze3d.vertex.PoseStack; | ||
import net.minecraft.client.model.EntityModel; | ||
import net.minecraft.client.model.geom.EntityModelSet; | ||
import net.minecraft.resources.ResourceLocation; | ||
import net.minecraft.world.MenuProvider; | ||
import net.minecraft.world.entity.player.Player; | ||
import net.minecraft.world.item.Item; | ||
import net.minecraft.world.item.ItemStack; | ||
import net.minecraftforge.api.distmarker.Dist; | ||
import net.minecraftforge.api.distmarker.OnlyIn; | ||
|
||
import javax.annotation.Nullable; | ||
|
||
|
||
public abstract class IMaidBackpack { | ||
public abstract ResourceLocation getId(); | ||
|
||
public abstract Item getItem(); | ||
|
||
public abstract void onPutOn(ItemStack stack, Player player, EntityMaid maid); | ||
|
||
public ItemStack getTakeOffItemStack(ItemStack stack, @Nullable Player player, EntityMaid maid) { | ||
return this.getItem().getDefaultInstance(); | ||
} | ||
|
||
public abstract void onTakeOff(ItemStack stack, Player player, EntityMaid maid); | ||
|
||
public abstract void onSpawnTombstone(EntityMaid maid, EntityTombstone tombstone); | ||
|
||
public abstract MenuProvider getGuiProvider(int entityId); | ||
|
||
public boolean hasBackpackData() { | ||
return false; | ||
} | ||
|
||
@Nullable | ||
public IBackpackData getBackpackData(EntityMaid maid) { | ||
return null; | ||
} | ||
|
||
public abstract int getAvailableMaxContainerIndex(); | ||
|
||
@OnlyIn(Dist.CLIENT) | ||
public abstract void offsetBackpackItem(PoseStack poseStack); | ||
|
||
@Nullable | ||
@OnlyIn(Dist.CLIENT) | ||
public abstract EntityModel<EntityMaid> getBackpackModel(EntityModelSet modelSet); | ||
|
||
@Nullable | ||
@OnlyIn(Dist.CLIENT) | ||
public abstract ResourceLocation getBackpackTexture(); | ||
|
||
protected final void dropAllItems(EntityMaid maid) { | ||
ItemsUtil.dropEntityItems(maid, maid.getMaidInv(), BackpackLevel.EMPTY_CAPACITY); | ||
} | ||
} |
84 changes: 84 additions & 0 deletions
84
src/main/java/com/github/tartaricacid/touhoulittlemaid/api/game/gomoku/AIService.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,84 @@ | ||
/* | ||
* https://github.com/anlingyi/xechat-idea | ||
* | ||
* Apache License | ||
* Version 2.0, January 2004 | ||
* http://www.apache.org/licenses/ | ||
*/ | ||
package com.github.tartaricacid.touhoulittlemaid.api.game.gomoku; | ||
|
||
/** | ||
* @author anlingyi | ||
* @date 2021/11/1 3:26 下午 | ||
*/ | ||
public interface AIService { | ||
/** | ||
* 获取AI棋位 | ||
* | ||
* @param chessData 已下棋子数据 | ||
* @param point 对手棋位 | ||
*/ | ||
Point getPoint(int[][] chessData, Point point); | ||
|
||
/** | ||
* 获取棋局状态 | ||
* | ||
* @param chessData 已下棋子数据 | ||
* @param point 落子棋位 | ||
*/ | ||
Statue getStatue(int[][] chessData, Point point); | ||
|
||
/** | ||
* AI配置 | ||
*/ | ||
class AIConfig { | ||
/** | ||
* 搜索深度 | ||
*/ | ||
private final int depth; | ||
/** | ||
* 最大启发式节点数 | ||
*/ | ||
private final int maxNodes; | ||
/** | ||
* debug | ||
*/ | ||
private final boolean debug; | ||
/** | ||
* 算杀 0.不开启 1.VCT 2.VCF | ||
*/ | ||
private final int vcx; | ||
/** | ||
* 算杀深度 | ||
*/ | ||
private final int vcxDepth; | ||
|
||
public AIConfig(int depth, int maxNodes, boolean debug, int vcx, int vcxDepth) { | ||
this.depth = depth; | ||
this.maxNodes = maxNodes; | ||
this.debug = debug; | ||
this.vcx = vcx; | ||
this.vcxDepth = vcxDepth; | ||
} | ||
|
||
public int getDepth() { | ||
return depth; | ||
} | ||
|
||
public int getMaxNodes() { | ||
return maxNodes; | ||
} | ||
|
||
public boolean isDebug() { | ||
return debug; | ||
} | ||
|
||
public int getVcx() { | ||
return vcx; | ||
} | ||
|
||
public int getVcxDepth() { | ||
return vcxDepth; | ||
} | ||
} | ||
} |
78 changes: 78 additions & 0 deletions
78
src/main/java/com/github/tartaricacid/touhoulittlemaid/api/game/gomoku/Point.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,78 @@ | ||
/* | ||
* https://github.com/anlingyi/xechat-idea | ||
* | ||
* Apache License | ||
* Version 2.0, January 2004 | ||
* http://www.apache.org/licenses/ | ||
*/ | ||
package com.github.tartaricacid.touhoulittlemaid.api.game.gomoku; | ||
|
||
import net.minecraft.nbt.CompoundTag; | ||
|
||
/** | ||
* 棋子点位 | ||
* | ||
* @author anlingyi | ||
* @date 2021/11/7 5:59 下午 | ||
*/ | ||
public class Point { | ||
public static final int EMPTY = 0; | ||
public static final int BLACK = 1; | ||
public static final int WHITE = 2; | ||
public static final Point NULL = new Point(-1, -1, 0); | ||
/** | ||
* 横坐标 | ||
*/ | ||
public final int x; | ||
/** | ||
* 纵坐标 | ||
*/ | ||
public final int y; | ||
/** | ||
* 棋子类型 1.黑 2.白 | ||
*/ | ||
public int type; | ||
/** | ||
* 得分 | ||
*/ | ||
public int score; | ||
|
||
public Point(int x, int y, int type) { | ||
this.x = x; | ||
this.y = y; | ||
this.type = type; | ||
} | ||
|
||
public static CompoundTag toTag(Point point) { | ||
CompoundTag tag = new CompoundTag(); | ||
tag.putInt("x", point.x); | ||
tag.putInt("y", point.y); | ||
tag.putInt("type", point.type); | ||
return tag; | ||
} | ||
|
||
public static Point fromTag(CompoundTag tag) { | ||
int x = tag.getInt("x"); | ||
int y = tag.getInt("y"); | ||
int type = tag.getInt("type"); | ||
return new Point(x, y, type); | ||
} | ||
|
||
@Override | ||
public boolean equals(Object other) { | ||
if (other == null) { | ||
return false; | ||
} else if (this == other) { | ||
return true; | ||
} else if (other instanceof Point otherPoint) { | ||
return otherPoint.x == this.x && otherPoint.y == this.y && otherPoint.type == this.type; | ||
} else { | ||
return false; | ||
} | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return (type == 1 ? "Black" : "White") + "[" + x + "," + y + ']'; | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
src/main/java/com/github/tartaricacid/touhoulittlemaid/api/game/gomoku/Statue.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,6 @@ | ||
package com.github.tartaricacid.touhoulittlemaid.api.game.gomoku; | ||
|
||
public enum Statue { | ||
WIN, | ||
IN_PROGRESS | ||
} |
Oops, something went wrong.