修复半自动和连发bug
This commit is contained in:
parent
3c7717303e
commit
ca73dacbb9
8 changed files with 49 additions and 45 deletions
|
@ -52,6 +52,7 @@ public class ClickHandler {
|
||||||
int button = event.getButton();
|
int button = event.getButton();
|
||||||
if (button == GLFW.GLFW_MOUSE_BUTTON_LEFT) {
|
if (button == GLFW.GLFW_MOUSE_BUTTON_LEFT) {
|
||||||
ModUtils.PACKET_HANDLER.sendToServer(new FireMessage(1));
|
ModUtils.PACKET_HANDLER.sendToServer(new FireMessage(1));
|
||||||
|
ClientEventHandler.holdFire = false;
|
||||||
}
|
}
|
||||||
if (button == GLFW.GLFW_MOUSE_BUTTON_RIGHT) {
|
if (button == GLFW.GLFW_MOUSE_BUTTON_RIGHT) {
|
||||||
if (player.hasEffect(ModMobEffects.SHOCK.get())) {
|
if (player.hasEffect(ModMobEffects.SHOCK.get())) {
|
||||||
|
@ -98,6 +99,10 @@ public class ClickHandler {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ModUtils.PACKET_HANDLER.sendToServer(new FireMessage(0));
|
ModUtils.PACKET_HANDLER.sendToServer(new FireMessage(0));
|
||||||
|
ClientEventHandler.holdFire = true;
|
||||||
|
if (stack.getOrCreateTag().getInt("fire_mode") == 1) {
|
||||||
|
ClientEventHandler.burstFireSize = (int) stack.getOrCreateTag().getDouble("burst_size");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,20 +75,21 @@ public class AK12ItemModel extends GeoModel<AK12Item> {
|
||||||
|
|
||||||
float posY = switch (type) {
|
float posY = switch (type) {
|
||||||
case 0 -> 0.781f;
|
case 0 -> 0.781f;
|
||||||
case 1 -> 0.351f;
|
case 1 -> 0.371f;
|
||||||
case 2 -> -0.04f;
|
case 2 -> -0.04f;
|
||||||
case 3 -> -0.01f;
|
case 3 -> -0.01f;
|
||||||
default -> 0f;
|
default -> 0f;
|
||||||
};
|
};
|
||||||
float scaleZ = switch (type) {
|
float scaleZ = switch (type) {
|
||||||
case 0 -> 0.45f;
|
case 0 -> 0.52f;
|
||||||
case 1 -> 0.4f;
|
case 1 -> 0.6f;
|
||||||
case 2 -> 0.77f;
|
case 2 -> 0.77f;
|
||||||
case 3 -> 0.78f;
|
case 3 -> 0.78f;
|
||||||
default -> 0f;
|
default -> 0f;
|
||||||
};
|
};
|
||||||
float posZ = switch (type) {
|
float posZ = switch (type) {
|
||||||
case 0, 1 -> 2.8f;
|
case 0 -> 3f;
|
||||||
|
case 1 -> 3.4f;
|
||||||
case 2 -> 4.1f;
|
case 2 -> 4.1f;
|
||||||
case 3 -> 4.5f;
|
case 3 -> 4.5f;
|
||||||
default -> 0f;
|
default -> 0f;
|
||||||
|
@ -123,11 +124,11 @@ public class AK12ItemModel extends GeoModel<AK12Item> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fireRotY = (float) Mth.lerp(0.3f * times, fireRotY, 0.2f * ClientEventHandler.recoilHorizon * fpz);
|
fireRotY = (float) Mth.lerp(0.3f * times, fireRotY, 0.2f * ClientEventHandler.recoilHorizon * fpz);
|
||||||
fireRotZ = (float) Mth.lerp(2f * times, fireRotZ, (0.4f + 0.5 * fpz) * ClientEventHandler.recoilHorizon);
|
fireRotZ = (float) Mth.lerp(2f * times, fireRotZ, (0.3f + 0.38 * fpz) * ClientEventHandler.recoilHorizon);
|
||||||
|
|
||||||
shen.setPosX(-0.4f * (float) (ClientEventHandler.recoilHorizon * (0.5 + 0.4 * ClientEventHandler.fireSpread)));
|
shen.setPosX(-0.4f * (float) (ClientEventHandler.recoilHorizon * (0.5 + 0.4 * ClientEventHandler.fireSpread)));
|
||||||
shen.setPosY((float) (0.15f * fp + 0.18f * fr));
|
shen.setPosY((float) (0.15f * fp + 0.18f * fr));
|
||||||
shen.setPosZ((float) (0.275 * fp + 0.34f * fr + 0.65 * fpz));
|
shen.setPosZ((float) (0.245 * fp + 0.29f * fr + 0.55 * fpz));
|
||||||
shen.setRotX((float) (0.01f * fp + 0.08f * fr + 0.01f * fpz));
|
shen.setRotX((float) (0.01f * fp + 0.08f * fr + 0.01f * fpz));
|
||||||
shen.setRotY(fireRotY);
|
shen.setRotY(fireRotY);
|
||||||
shen.setRotZ(fireRotZ);
|
shen.setRotZ(fireRotZ);
|
||||||
|
|
|
@ -129,7 +129,7 @@ public class AK47ItemModel extends GeoModel<AK47Item> {
|
||||||
|
|
||||||
shen.setPosX(-0.4f * (float) (ClientEventHandler.recoilHorizon * (0.5 + 0.4 * ClientEventHandler.fireSpread)));
|
shen.setPosX(-0.4f * (float) (ClientEventHandler.recoilHorizon * (0.5 + 0.4 * ClientEventHandler.fireSpread)));
|
||||||
shen.setPosY((float) (0.15f * fp + 0.18f * fr));
|
shen.setPosY((float) (0.15f * fp + 0.18f * fr));
|
||||||
shen.setPosZ((float) (0.365 * fp + 0.42f * fr + 0.95 * fpz));
|
shen.setPosZ((float) (0.475 * fp + 0.64f * fr + 1.25 * fpz));
|
||||||
shen.setRotX((float) (0.01f * fp + 0.08f * fr + 0.01f * fpz));
|
shen.setRotX((float) (0.01f * fp + 0.08f * fr + 0.01f * fpz));
|
||||||
shen.setRotY(fireRotY);
|
shen.setRotY(fireRotY);
|
||||||
shen.setRotZ(fireRotZ);
|
shen.setRotZ(fireRotZ);
|
||||||
|
|
|
@ -125,14 +125,14 @@ public class Hk416ItemModel extends GeoModel<Hk416Item> {
|
||||||
|
|
||||||
shen.setPosX(-0.4f * (float) (ClientEventHandler.recoilHorizon * (0.5 + 0.4 * ClientEventHandler.fireSpread)));
|
shen.setPosX(-0.4f * (float) (ClientEventHandler.recoilHorizon * (0.5 + 0.4 * ClientEventHandler.fireSpread)));
|
||||||
shen.setPosY((float) (0.15f * fp + 0.18f * fr));
|
shen.setPosY((float) (0.15f * fp + 0.18f * fr));
|
||||||
shen.setPosZ((float) (0.275 * fp + 0.34f * fr + 0.65 * fpz));
|
shen.setPosZ((float) (0.475 * fp + 0.64f * fr + 1.15 * fpz));
|
||||||
shen.setRotX((float) (0.01f * fp + 0.05f * fr + 0.01f * fpz));
|
shen.setRotX((float) (0.01f * fp + 0.05f * fr + 0.01f * fpz));
|
||||||
shen.setRotY(fireRotY);
|
shen.setRotY(fireRotY);
|
||||||
shen.setRotZ(fireRotZ);
|
shen.setRotZ(fireRotZ);
|
||||||
|
|
||||||
shen.setPosX((float) (shen.getPosX() * (1 - 0.1 * zt)));
|
shen.setPosX((float) (shen.getPosX() * (1 - 0.1 * zt)));
|
||||||
shen.setPosY((float) (shen.getPosY() * (-1 + 0.8 * zt)));
|
shen.setPosY((float) (shen.getPosY() * (-1 + 0.8 * zt)));
|
||||||
shen.setPosZ((float) (shen.getPosZ() * (1 + 0.3 * zt)));
|
shen.setPosZ((float) (shen.getPosZ() * (1 - 0.1 * zt)));
|
||||||
shen.setRotX((float) (shen.getRotX() * (1 - (type == 3 ? 0.96 : type == 1 ? 0.8 : 0.9) * zt)));
|
shen.setRotX((float) (shen.getRotX() * (1 - (type == 3 ? 0.96 : type == 1 ? 0.8 : 0.9) * zt)));
|
||||||
shen.setRotY((float) (shen.getRotY() * (1 - (type == 3 ? 0.95 : 0.9) * zt)));
|
shen.setRotY((float) (shen.getRotY() * (1 - (type == 3 ? 0.95 : 0.9) * zt)));
|
||||||
shen.setRotZ((float) (shen.getRotZ() * (1 - 0.4 * zt)));
|
shen.setRotZ((float) (shen.getRotZ() * (1 - 0.4 * zt)));
|
||||||
|
|
|
@ -143,7 +143,7 @@ public class M4ItemModel extends GeoModel<M4Item> {
|
||||||
|
|
||||||
shen.setPosX(-0.4f * (float) (ClientEventHandler.recoilHorizon * (0.5 + 0.4 * ClientEventHandler.fireSpread)));
|
shen.setPosX(-0.4f * (float) (ClientEventHandler.recoilHorizon * (0.5 + 0.4 * ClientEventHandler.fireSpread)));
|
||||||
shen.setPosY((float) (0.15f * fp + 0.18f * fr));
|
shen.setPosY((float) (0.15f * fp + 0.18f * fr));
|
||||||
shen.setPosZ((float) (0.275 * fp + 0.34f * fr + 0.65 * fpz));
|
shen.setPosZ((float) (0.475 * fp + 0.64f * fr + 1.15 * fpz));
|
||||||
shen.setRotX((float) (0.01f * fp + 0.05f * fr + 0.01f * fpz));
|
shen.setRotX((float) (0.01f * fp + 0.05f * fr + 0.01f * fpz));
|
||||||
shen.setRotY(fireRotY);
|
shen.setRotY(fireRotY);
|
||||||
shen.setRotZ(fireRotZ);
|
shen.setRotZ(fireRotZ);
|
||||||
|
@ -155,7 +155,7 @@ public class M4ItemModel extends GeoModel<M4Item> {
|
||||||
|
|
||||||
shen.setPosX((float) (shen.getPosX() * (1 - 0.1 * zt)));
|
shen.setPosX((float) (shen.getPosX() * (1 - 0.1 * zt)));
|
||||||
shen.setPosY((float) (shen.getPosY() * (-1 + 0.8 * zt)));
|
shen.setPosY((float) (shen.getPosY() * (-1 + 0.8 * zt)));
|
||||||
shen.setPosZ((float) (shen.getPosZ() * (1 + 0.3 * zt)));
|
shen.setPosZ((float) (shen.getPosZ() * (1 - 0.1 * zt)));
|
||||||
shen.setRotX((float) (shen.getRotX() * (1 - (type == 3 ? 0.96 : type == 1 ? 0.8 : 0.9) * zt)));
|
shen.setRotX((float) (shen.getRotX() * (1 - (type == 3 ? 0.96 : type == 1 ? 0.8 : 0.9) * zt)));
|
||||||
shen.setRotY((float) (shen.getRotY() * (1 - (type == 3 ? 0.95 : 0.9) * zt)));
|
shen.setRotY((float) (shen.getRotY() * (1 - (type == 3 ? 0.95 : 0.9) * zt)));
|
||||||
shen.setRotZ((float) (shen.getRotZ() * (1 - 0.4 * zt)));
|
shen.setRotZ((float) (shen.getRotZ() * (1 - 0.4 * zt)));
|
||||||
|
|
|
@ -112,6 +112,9 @@ public class ClientEventHandler {
|
||||||
public static double customZoom = 0;
|
public static double customZoom = 0;
|
||||||
public static MillisTimer clientTimer = new MillisTimer();
|
public static MillisTimer clientTimer = new MillisTimer();
|
||||||
|
|
||||||
|
public static boolean holdFire = false;
|
||||||
|
public static int burstFireSize = 0;
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public static void handleWeaponTurn(RenderHandEvent event) {
|
public static void handleWeaponTurn(RenderHandEvent event) {
|
||||||
LocalPlayer player = Minecraft.getInstance().player;
|
LocalPlayer player = Minecraft.getInstance().player;
|
||||||
|
@ -152,7 +155,7 @@ public class ClientEventHandler {
|
||||||
public static void handleWeaponFire(TickEvent.RenderTickEvent event) {
|
public static void handleWeaponFire(TickEvent.RenderTickEvent event) {
|
||||||
ClientLevel level = Minecraft.getInstance().level;
|
ClientLevel level = Minecraft.getInstance().level;
|
||||||
Player player = Minecraft.getInstance().player;
|
Player player = Minecraft.getInstance().player;
|
||||||
// if (notInGame()) return;
|
|
||||||
if (player == null) return;
|
if (player == null) return;
|
||||||
if (level == null) return;
|
if (level == null) return;
|
||||||
|
|
||||||
|
@ -191,8 +194,8 @@ public class ClientEventHandler {
|
||||||
gunSpread = Mth.lerp(0.07 * times, gunSpread, spread);
|
gunSpread = Mth.lerp(0.07 * times, gunSpread, spread);
|
||||||
|
|
||||||
// 开火部分
|
// 开火部分
|
||||||
double weight = stack.getOrCreateTag().getDouble("weight") + stack.getOrCreateTag().getDouble("CustomWeight");
|
|
||||||
|
|
||||||
|
double weight = stack.getOrCreateTag().getDouble("weight") + stack.getOrCreateTag().getDouble("CustomWeight");
|
||||||
double speed = 1 - (0.04 * weight);
|
double speed = 1 - (0.04 * weight);
|
||||||
|
|
||||||
if (player.getPersistentData().getDouble("noRun") == 0 && player.isSprinting() && GLFW.glfwGetMouseButton(Minecraft.getInstance().getWindow().getWindow(), GLFW.GLFW_MOUSE_BUTTON_RIGHT) != GLFW.GLFW_PRESS) {
|
if (player.getPersistentData().getDouble("noRun") == 0 && player.isSprinting() && GLFW.glfwGetMouseButton(Minecraft.getInstance().getWindow().getWindow(), GLFW.GLFW_MOUSE_BUTTON_RIGHT) != GLFW.GLFW_PRESS) {
|
||||||
|
@ -201,14 +204,13 @@ public class ClientEventHandler {
|
||||||
cantFireTime = Mth.clamp(cantFireTime - 6 * speed * times, 0, 24);
|
cantFireTime = Mth.clamp(cantFireTime - 6 * speed * times, 0, 24);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GLFW.glfwGetMouseButton(Minecraft.getInstance().getWindow().getWindow(), GLFW.GLFW_MOUSE_BUTTON_LEFT) == GLFW.GLFW_PRESS
|
if ((holdFire || burstFireSize > 0)
|
||||||
&& (player.getMainHandItem().is(ModTags.Items.NORMAL_GUN)
|
&& (player.getMainHandItem().is(ModTags.Items.NORMAL_GUN)
|
||||||
&& cantFireTime == 0
|
&& cantFireTime == 0
|
||||||
&& drawTime < 0.01
|
&& drawTime < 0.01
|
||||||
&& !notInGame()
|
&& !notInGame()
|
||||||
&& !player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new ModVariables.PlayerVariables()).edit
|
&& !player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new ModVariables.PlayerVariables()).edit
|
||||||
&& ((GLFW.glfwGetMouseButton(Minecraft.getInstance().getWindow().getWindow(), GLFW.GLFW_MOUSE_BUTTON_LEFT) == GLFW.GLFW_PRESS || stack.getOrCreateTag().getInt("burst_fire") > 0)
|
&& (!(stack.getOrCreateTag().getBoolean("is_normal_reloading") || stack.getOrCreateTag().getBoolean("is_empty_reloading"))
|
||||||
&& !(stack.getOrCreateTag().getBoolean("is_normal_reloading") || stack.getOrCreateTag().getBoolean("is_empty_reloading"))
|
|
||||||
&& !stack.getOrCreateTag().getBoolean("reloading")
|
&& !stack.getOrCreateTag().getBoolean("reloading")
|
||||||
&& !stack.getOrCreateTag().getBoolean("charging")
|
&& !stack.getOrCreateTag().getBoolean("charging")
|
||||||
&& stack.getOrCreateTag().getInt("ammo") > 0
|
&& stack.getOrCreateTag().getInt("ammo") > 0
|
||||||
|
@ -216,41 +218,41 @@ public class ClientEventHandler {
|
||||||
&& !stack.getOrCreateTag().getBoolean("need_bolt_action"))
|
&& !stack.getOrCreateTag().getBoolean("need_bolt_action"))
|
||||||
|| (stack.is(ModItems.MINIGUN.get()) && !player.isSprinting() && stack.getOrCreateTag().getDouble("overheat") == 0 && !player.getCooldowns().isOnCooldown(stack.getItem()) && stack.getOrCreateTag().getDouble("minigun_rotation") >= 10
|
|| (stack.is(ModItems.MINIGUN.get()) && !player.isSprinting() && stack.getOrCreateTag().getDouble("overheat") == 0 && !player.getCooldowns().isOnCooldown(stack.getItem()) && stack.getOrCreateTag().getDouble("minigun_rotation") >= 10
|
||||||
))) {
|
))) {
|
||||||
double customRpm = 0;
|
int customRpm = 0;
|
||||||
|
|
||||||
if (stack.getItem() == ModItems.DEVOTION.get()) {
|
if (stack.getItem() == ModItems.DEVOTION.get()) {
|
||||||
customRpm = stack.getOrCreateTag().getInt("customRpm");
|
customRpm = stack.getOrCreateTag().getInt("customRpm");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getItem() == ModItems.MINIGUN.get() && player.isInWater()) {
|
if (stack.getItem() == ModItems.MINIGUN.get() && player.isInWater()) {
|
||||||
customRpm = -0.25 * stack.getOrCreateTag().getDouble("rpm");
|
customRpm = (int) (-0.25 * stack.getOrCreateTag().getDouble("rpm"));
|
||||||
}
|
}
|
||||||
|
|
||||||
double rpm = stack.getOrCreateTag().getDouble("rpm") + customRpm;
|
int rpm = (int) (stack.getOrCreateTag().getDouble("rpm") + customRpm);
|
||||||
if (rpm == 0) {
|
if (rpm == 0) {
|
||||||
rpm = 600;
|
rpm = 600;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GunsTool.getPerkIntTag(stack, "DesperadoTimePost") > 0) {
|
if (GunsTool.getPerkIntTag(stack, "DesperadoTimePost") > 0) {
|
||||||
int perkLevel = PerkHelper.getItemPerkLevel(ModPerks.DESPERADO.get(), stack);
|
int perkLevel = PerkHelper.getItemPerkLevel(ModPerks.DESPERADO.get(), stack);
|
||||||
rpm *= 1.25 + 0.05 * perkLevel;
|
rpm *= (int) (1.25 + 0.05 * perkLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
double rps = rpm / 60;
|
double rps = (double) rpm / 60;
|
||||||
|
|
||||||
// cooldown in ms
|
// cooldown in ms
|
||||||
double cooldown = 1000 / rps;
|
int cooldown = (int) (1000 / rps);
|
||||||
|
|
||||||
if (!clientTimer.started()) {
|
if (!clientTimer.started()) {
|
||||||
clientTimer.start();
|
clientTimer.start();
|
||||||
// 首发瞬间发射
|
// 首发瞬间发射
|
||||||
clientTimer.setProgress((long) (cooldown + 1));
|
clientTimer.setProgress((cooldown + 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (clientTimer.getProgress() >= cooldown) {
|
if (clientTimer.getProgress() >= cooldown) {
|
||||||
shootClient(player);
|
shootClient(player);
|
||||||
ModUtils.PACKET_HANDLER.sendToServer(new ShootMessage(spread));
|
ModUtils.PACKET_HANDLER.sendToServer(new ShootMessage(spread));
|
||||||
clientTimer.setProgress((long) (clientTimer.getProgress() - cooldown));
|
clientTimer.setProgress((clientTimer.getProgress() - cooldown));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (notInGame()) {
|
if (notInGame()) {
|
||||||
|
@ -266,9 +268,19 @@ public class ClientEventHandler {
|
||||||
public static void shootClient(Player player) {
|
public static void shootClient(Player player) {
|
||||||
ItemStack stack = player.getMainHandItem();
|
ItemStack stack = player.getMainHandItem();
|
||||||
if (stack.is(ModTags.Items.NORMAL_GUN)) {
|
if (stack.is(ModTags.Items.NORMAL_GUN)) {
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getInt("ammo") > 0) {
|
if (stack.getOrCreateTag().getInt("ammo") > 0) {
|
||||||
|
|
||||||
|
int mode = stack.getOrCreateTag().getInt("fire_mode");
|
||||||
|
if (mode != 2) {
|
||||||
|
holdFire = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mode == 1 && stack.getOrCreateTag().getInt("ammo") == 1) {
|
||||||
|
burstFireSize = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
burstFireSize--;
|
||||||
|
|
||||||
playGunClientSounds(player);
|
playGunClientSounds(player);
|
||||||
handleClientShoot();
|
handleClientShoot();
|
||||||
}
|
}
|
||||||
|
|
|
@ -138,14 +138,6 @@ public class FireMessage {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tag.getInt("fire_mode") == 1) {
|
|
||||||
player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> {
|
|
||||||
capability.holdFire = false;
|
|
||||||
capability.syncPlayerVariables(player);
|
|
||||||
});
|
|
||||||
tag.putInt("burst_fire", (int) tag.getDouble("burst_size"));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tag.getDouble("prepare") == 0 && tag.getBoolean("reloading") && tag.getInt("ammo") > 0) {
|
if (tag.getDouble("prepare") == 0 && tag.getBoolean("reloading") && tag.getInt("ammo") > 0) {
|
||||||
tag.putDouble("force_stop", 1);
|
tag.putDouble("force_stop", 1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,7 +67,8 @@ public class ShootMessage {
|
||||||
double rpm = stack.getOrCreateTag().getDouble("rpm") + stack.getOrCreateTag().getInt("customRpm");;
|
double rpm = stack.getOrCreateTag().getDouble("rpm") + stack.getOrCreateTag().getInt("customRpm");;
|
||||||
|
|
||||||
int coolDownTick = (int) Math.ceil(20 / (rpm / 60));
|
int coolDownTick = (int) Math.ceil(20 / (rpm / 60));
|
||||||
double mode = stack.getOrCreateTag().getInt("fire_mode");
|
int mode = stack.getOrCreateTag().getInt("fire_mode");
|
||||||
|
|
||||||
int projectileAmount = (int) stack.getOrCreateTag().getDouble("projectile_amount");
|
int projectileAmount = (int) stack.getOrCreateTag().getDouble("projectile_amount");
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getInt("ammo") > 0) {
|
if (stack.getOrCreateTag().getInt("ammo") > 0) {
|
||||||
|
@ -75,17 +76,10 @@ public class ShootMessage {
|
||||||
int singleInterval = 0;
|
int singleInterval = 0;
|
||||||
int burstCooldown = 0;
|
int burstCooldown = 0;
|
||||||
|
|
||||||
if (mode != 2) {
|
if (mode == 0) {
|
||||||
player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> {
|
singleInterval = coolDownTick;
|
||||||
capability.holdFire = false;
|
} else if (mode == 1) {
|
||||||
capability.syncPlayerVariables(player);
|
burstCooldown = stack.getOrCreateTag().getInt("burst_fire") == 0 ? coolDownTick + 3 : 0;
|
||||||
});
|
|
||||||
if (mode == 0) {
|
|
||||||
singleInterval = coolDownTick;
|
|
||||||
} else if (mode == 1) {
|
|
||||||
burstCooldown = stack.getOrCreateTag().getInt("burst_fire") == 0 ? coolDownTick + 3 : 0;
|
|
||||||
stack.getOrCreateTag().putInt("burst_fire", (stack.getOrCreateTag().getInt("burst_fire") - 1));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Add table
Reference in a new issue