Skip to content

Commit

Permalink
任务接口中加入是否可蹲下,gradle中降帕秋莉手册替换为modrinth的maven库中的 (#571)
Browse files Browse the repository at this point in the history
* 任务接口中加入是否可蹲下,gradle中降帕秋莉手册替换为modrinth的maven库中的

* 完成部分修正

---------

Co-authored-by: tartaric_acid <[email protected]>
  • Loading branch information
Crystal1921 and TartaricAcid authored Sep 11, 2024
1 parent 840158b commit e38479d
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 5 deletions.
3 changes: 1 addition & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -172,12 +172,11 @@ dependencies {
implementation "maven.modrinth:cloth-config:${cloth_config_version}"
implementation "maven.modrinth:iron-chests:${iron_chests_version}"
implementation "maven.modrinth:carry-on:${carry_on_version}"
implementation "maven.modrinth:patchouli:${patchouli_version}"
// IPN
runtimeOnly "maven.modrinth:kotlin-for-forge:5.4.0"
runtimeOnly "maven.modrinth:libipn:neoforge-1.21-6.0.2"
implementation "maven.modrinth:inventory-profiles-next:neoforge-1.21-2.0.4"
// Patchouli
implementation "maven.modrinth:patchouli:1.21-87-neoforge"
}

// 用于 neoforge.mods 里替换那一堆 ${xxxx}
Expand Down
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ top_version=1.21_neo-12.0.3
jade_version=15.0.5+neoforge
iron_chests_version=1.21-neoforge-16.0.7
carry_on_version=2.2.1-neoforge
patchouli_version=1.21-87-neoforge

#########################################################
# Mod Info #
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,17 @@ default boolean enableLookAndRandomWalk(EntityMaid maid) {
return true;
}

/**
* 处于该工作模式时,女仆是否允许坐在娱乐方块上?
*
* @param maid 女仆
* @param joyType 娱乐方块类型
* @return 处于该工作模式时,女仆是否允许坐在娱乐方块上?
*/
default boolean canSitInJoy(EntityMaid maid, String joyType) {
return false;
}

/**
* 获取任务启用的条件提示文本
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.github.tartaricacid.touhoulittlemaid.entity.item;

import com.github.tartaricacid.touhoulittlemaid.api.task.IMaidTask;
import com.github.tartaricacid.touhoulittlemaid.entity.favorability.FavorabilityManager;
import com.github.tartaricacid.touhoulittlemaid.entity.favorability.Type;
import com.github.tartaricacid.touhoulittlemaid.entity.passive.EntityMaid;
Expand Down Expand Up @@ -82,10 +83,21 @@ private void tickMaid(EntityMaid maid) {
maid.setYHeadRot(this.getYRot());
if (tickCount % 20 == 0) {
FavorabilityManager manager = maid.getFavorabilityManager();
manager.apply(this.getJoyType());
if (!this.isIdleSchedule(maid) && !isGomokuTask(maid)) {
maid.stopRiding();
String joyType = this.getJoyType();
IMaidTask task = maid.getTask();

// 给予好感度提升
manager.apply(joyType);
// 如果是空闲状态,那么娱乐方块可以随便坐
if (this.isIdleSchedule(maid)) {
return;
}
// 如果是工作状态,看看这个工作是否允许你坐在上面
if (this.isWorkSchedule(maid) && task.canSitInJoy(maid, joyType)) {
return;
}
// 否则,不允许在上面待着
maid.stopRiding();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.github.tartaricacid.touhoulittlemaid.TouhouLittleMaid;
import com.github.tartaricacid.touhoulittlemaid.api.task.IMaidTask;
import com.github.tartaricacid.touhoulittlemaid.entity.ai.brain.task.MaidGomokuTask;
import com.github.tartaricacid.touhoulittlemaid.entity.favorability.Type;
import com.github.tartaricacid.touhoulittlemaid.entity.passive.EntityMaid;
import com.github.tartaricacid.touhoulittlemaid.init.InitItems;
import com.github.tartaricacid.touhoulittlemaid.init.InitSounds;
Expand Down Expand Up @@ -41,4 +42,9 @@ public List<Pair<Integer, BehaviorControl<? super EntityMaid>>> createBrainTasks
Pair<Integer, BehaviorControl<? super EntityMaid>> gomoku = Pair.of(5, new MaidGomokuTask(0.6f, 2));
return Lists.newArrayList(gomoku);
}

@Override
public boolean canSitInJoy(EntityMaid maid, String joyType) {
return Type.GOMOKU.getTypeName().equals(joyType);
}
}

0 comments on commit e38479d

Please sign in to comment.