修bug
This commit is contained in:
parent
460f2de5a9
commit
5b64d1ec22
3 changed files with 56 additions and 26 deletions
|
@ -83,7 +83,7 @@ public class GunEventHandler {
|
|||
|
||||
var tag = stack.getOrCreateTag();
|
||||
|
||||
if ((player.getPersistentData().getBoolean("holdFire") || (player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new ModVariables.PlayerVariables())).zoom) && !player.isSprinting()) {
|
||||
if ((player.getPersistentData().getBoolean("holdFire") || (player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new ModVariables.PlayerVariables())).zoom)) {
|
||||
if (tag.getDouble("minigun_rotation") < 10) {
|
||||
tag.putDouble("minigun_rotation", (tag.getDouble("minigun_rotation") + 1));
|
||||
}
|
||||
|
@ -523,7 +523,14 @@ public class GunEventHandler {
|
|||
// 一阶段结束,检查备弹,如果有则二阶段启动,无则直接跳到三阶段
|
||||
if ((tag.getDouble("prepare") == 1 || tag.getDouble("prepare_load") == 1)) {
|
||||
|
||||
// 检查备弹
|
||||
int count = 0;
|
||||
for (var inv : player.getInventory().items) {
|
||||
if (inv.is(ModItems.CREATIVE_AMMO_BOX.get())) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
if (count == 0) {
|
||||
var capability = player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new ModVariables.PlayerVariables());
|
||||
if (stack.is(ModTags.Items.USE_SHOTGUN_AMMO) && capability.shotgunAmmo == 0) {
|
||||
tag.putBoolean("force_stage3_start", true);
|
||||
|
@ -536,6 +543,11 @@ public class GunEventHandler {
|
|||
} else {
|
||||
tag.putInt("reload_stage", 2);
|
||||
}
|
||||
} else {
|
||||
tag.putInt("reload_stage", 2);
|
||||
}
|
||||
// 检查备弹
|
||||
|
||||
}
|
||||
|
||||
// 强制停止换弹,进入三阶段
|
||||
|
@ -583,6 +595,15 @@ public class GunEventHandler {
|
|||
}
|
||||
|
||||
// 备弹耗尽结束
|
||||
|
||||
int count = 0;
|
||||
for (var inv : player.getInventory().items) {
|
||||
if (inv.is(ModItems.CREATIVE_AMMO_BOX.get())) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
if (count == 0) {
|
||||
var capability = player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new ModVariables.PlayerVariables());
|
||||
if (stack.is(ModTags.Items.USE_SHOTGUN_AMMO) && capability.shotgunAmmo == 0) {
|
||||
tag.putInt("reload_stage", 3);
|
||||
|
@ -593,6 +614,8 @@ public class GunEventHandler {
|
|||
} else if (stack.is(ModTags.Items.USE_RIFLE_AMMO) && capability.rifleAmmo == 0) {
|
||||
tag.putInt("reload_stage", 3);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 强制结束
|
||||
if (tag.getBoolean("stop")) {
|
||||
|
|
|
@ -171,6 +171,12 @@ public class MinigunItem extends GunItem implements GeoItem, AnimatedItem {
|
|||
yRot = yRot + 90 % 360;
|
||||
|
||||
var leftPos = new Vector3d(1.2, -0.3, 0.3);
|
||||
|
||||
if (entity.isSprinting()) {
|
||||
leftPos = new Vector3d(1., -0.4, -0.4);
|
||||
}
|
||||
|
||||
|
||||
leftPos.rotateZ(-entity.getXRot() * Mth.DEG_TO_RAD);
|
||||
leftPos.rotateY(-yRot * Mth.DEG_TO_RAD);
|
||||
|
||||
|
@ -183,7 +189,7 @@ public class MinigunItem extends GunItem implements GeoItem, AnimatedItem {
|
|||
cooldown = -0.5;
|
||||
}
|
||||
|
||||
if (entity instanceof ServerPlayer serverPlayer && entity.level() instanceof ServerLevel serverLevel && itemstack.getOrCreateTag().getDouble("heat") > 4) {
|
||||
if (entity instanceof ServerPlayer serverPlayer && entity.level() instanceof ServerLevel serverLevel && itemstack.getOrCreateTag().getDouble("heat") > 4 && entity.isInWaterOrRain()) {
|
||||
if (entity.isInWater()) {
|
||||
ParticleTool.sendParticle(serverLevel, ParticleTypes.BUBBLE_COLUMN_UP,
|
||||
entity.getX() + leftPos.x,
|
||||
|
@ -191,7 +197,6 @@ public class MinigunItem extends GunItem implements GeoItem, AnimatedItem {
|
|||
entity.getZ() + leftPos.z,
|
||||
1, 0.1, 0.1, 0.1, 0.002, true, serverPlayer);
|
||||
}
|
||||
|
||||
ParticleTool.sendParticle(serverLevel, ModParticleTypes.CUSTOM_CLOUD.get(),
|
||||
entity.getX() + leftPos.x,
|
||||
entity.getEyeY() + leftPos.y,
|
||||
|
|
|
@ -152,10 +152,12 @@ public class FireMessage {
|
|||
}
|
||||
}
|
||||
|
||||
if (handItem.getItem() == ModItems.BOCEK.get()) {
|
||||
player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> {
|
||||
capability.bowPullHold = true;
|
||||
capability.syncPlayerVariables(player);
|
||||
});
|
||||
}
|
||||
|
||||
// 栓动武器左键手动拉栓
|
||||
if (tag.getInt("bolt_action_time") > 0 && tag.getInt("ammo") > 0 && tag.getInt("bolt_action_anim") == 0) {
|
||||
|
|
Loading…
Add table
Reference in a new issue