修复波塞科拉弓后切换武器保留拉弓进度的bug

This commit is contained in:
Atsuishio 2025-04-10 17:43:59 +08:00 committed by Light_Quanta
parent dab59fce2a
commit 7455e08036
No known key found for this signature in database
GPG key ID: 11A39A1B8C890959
2 changed files with 16 additions and 1 deletions

View file

@ -1507,6 +1507,10 @@ public class ClientEventHandler {
lungeSprint = 0; lungeSprint = 0;
lungeAttack = 0; lungeAttack = 0;
burstFireAmount = 0; burstFireAmount = 0;
pullTimer = 0;
bowTimer = 0;
handTimer = 0;
handPos = 0;
} }
private static void handleWeaponDraw(LivingEntity entity) { private static void handleWeaponDraw(LivingEntity entity) {

View file

@ -381,6 +381,12 @@ public class LivingEventHandler {
var cap = player.getData(ModAttachments.PLAYER_VARIABLE).watch(); var cap = player.getData(ModAttachments.PLAYER_VARIABLE).watch();
cap.edit = false; cap.edit = false;
if (oldStack.is(ModItems.BOCEK)) {
oldData.data().putInt("Power", 0);
cap.bowPullHold = false;
}
player.setData(ModAttachments.PLAYER_VARIABLE, cap); player.setData(ModAttachments.PLAYER_VARIABLE, cap);
cap.sync(player); cap.sync(player);
@ -414,6 +420,12 @@ public class LivingEventHandler {
newData.charge.timer.reset(); newData.charge.timer.reset();
} }
var cap = player.getData(ModAttachments.PLAYER_VARIABLE).watch();
if (newStack.is(ModItems.BOCEK)) {
newData.data().putInt("Power", 0);
cap.bowPullHold = false;
}
int level = newData.perk.getLevel(ModPerks.KILLING_TALLY); int level = newData.perk.getLevel(ModPerks.KILLING_TALLY);
if (level != 0) { if (level != 0) {
GunsTool.setPerkIntTag(newTag, "KillingTally", 0); GunsTool.setPerkIntTag(newTag, "KillingTally", 0);
@ -423,7 +435,6 @@ public class LivingEventHandler {
PacketDistributor.sendToPlayer(serverPlayer, new DrawClientMessage(true)); PacketDistributor.sendToPlayer(serverPlayer, new DrawClientMessage(true));
} }
var cap = player.getData(ModAttachments.PLAYER_VARIABLE).watch();
cap.tacticalSprint = false; cap.tacticalSprint = false;
player.setData(ModAttachments.PLAYER_VARIABLE, cap); player.setData(ModAttachments.PLAYER_VARIABLE, cap);
cap.sync(player); cap.sync(player);