优化GunData结构
This commit is contained in:
parent
b5b90ab83d
commit
7e5b24617d
90 changed files with 479 additions and 479 deletions
|
@ -337,7 +337,7 @@ public class ClickHandler {
|
||||||
handTimer = 0;
|
handTimer = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!gunItem.useBackpackAmmo(stack) && data.ammo() <= 0 && data.reload.time() == 0) {
|
if (!gunItem.useBackpackAmmo(stack) && data.ammo.get() <= 0 && data.reload.time() == 0) {
|
||||||
if (ReloadConfig.LEFT_CLICK_RELOAD.get()) {
|
if (ReloadConfig.LEFT_CLICK_RELOAD.get()) {
|
||||||
PacketDistributor.sendToServer(new ReloadMessage(0));
|
PacketDistributor.sendToServer(new ReloadMessage(0));
|
||||||
ClientEventHandler.burstFireAmount = 0;
|
ClientEventHandler.burstFireAmount = 0;
|
||||||
|
@ -346,10 +346,10 @@ public class ClickHandler {
|
||||||
PacketDistributor.sendToServer(new FireMessage(0, handTimer, zoom));
|
PacketDistributor.sendToServer(new FireMessage(0, handTimer, zoom));
|
||||||
if ((!data.reloading()
|
if ((!data.reloading()
|
||||||
&& !data.charging()
|
&& !data.charging()
|
||||||
&& !data.bolt.needed())
|
&& !data.bolt.needed.get())
|
||||||
&& drawTime < 0.01
|
&& drawTime < 0.01
|
||||||
) {
|
) {
|
||||||
if (data.fireMode() == 1) {
|
if (data.fireMode.get() == 1) {
|
||||||
if (ClientEventHandler.burstFireAmount == 0) {
|
if (ClientEventHandler.burstFireAmount == 0) {
|
||||||
ClientEventHandler.burstFireAmount = data.burstAmount();
|
ClientEventHandler.burstFireAmount = data.burstAmount();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package com.atsuishio.superbwarfare.client;
|
package com.atsuishio.superbwarfare.client;
|
||||||
|
|
||||||
import com.atsuishio.superbwarfare.item.gun.data.Attachment;
|
|
||||||
import com.atsuishio.superbwarfare.item.gun.data.AttachmentType;
|
|
||||||
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
||||||
|
import com.atsuishio.superbwarfare.item.gun.data.subdata.Attachment;
|
||||||
|
import com.atsuishio.superbwarfare.item.gun.data.value.AttachmentType;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import software.bernie.geckolib.cache.object.GeoBone;
|
import software.bernie.geckolib.cache.object.GeoBone;
|
||||||
|
|
||||||
|
|
|
@ -5,8 +5,8 @@ import com.atsuishio.superbwarfare.client.AnimationHelper;
|
||||||
import com.atsuishio.superbwarfare.client.overlay.CrossHairOverlay;
|
import com.atsuishio.superbwarfare.client.overlay.CrossHairOverlay;
|
||||||
import com.atsuishio.superbwarfare.event.ClientEventHandler;
|
import com.atsuishio.superbwarfare.event.ClientEventHandler;
|
||||||
import com.atsuishio.superbwarfare.init.ModTags;
|
import com.atsuishio.superbwarfare.init.ModTags;
|
||||||
import com.atsuishio.superbwarfare.item.gun.data.AttachmentType;
|
|
||||||
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
||||||
|
import com.atsuishio.superbwarfare.item.gun.data.value.AttachmentType;
|
||||||
import com.atsuishio.superbwarfare.item.gun.rifle.AK12Item;
|
import com.atsuishio.superbwarfare.item.gun.rifle.AK12Item;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
|
|
@ -5,8 +5,8 @@ import com.atsuishio.superbwarfare.client.AnimationHelper;
|
||||||
import com.atsuishio.superbwarfare.client.overlay.CrossHairOverlay;
|
import com.atsuishio.superbwarfare.client.overlay.CrossHairOverlay;
|
||||||
import com.atsuishio.superbwarfare.event.ClientEventHandler;
|
import com.atsuishio.superbwarfare.event.ClientEventHandler;
|
||||||
import com.atsuishio.superbwarfare.init.ModTags;
|
import com.atsuishio.superbwarfare.init.ModTags;
|
||||||
import com.atsuishio.superbwarfare.item.gun.data.AttachmentType;
|
|
||||||
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
||||||
|
import com.atsuishio.superbwarfare.item.gun.data.value.AttachmentType;
|
||||||
import com.atsuishio.superbwarfare.item.gun.rifle.AK47Item;
|
import com.atsuishio.superbwarfare.item.gun.rifle.AK47Item;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
|
|
@ -49,7 +49,7 @@ public class Glock18ItemModel extends GeoModel<Glock18Item> {
|
||||||
|
|
||||||
var data = GunData.from(stack);
|
var data = GunData.from(stack);
|
||||||
var tag = data.tag();
|
var tag = data.tag();
|
||||||
int mode = data.fireMode();
|
int mode = data.fireMode.get();
|
||||||
if (mode == 0) {
|
if (mode == 0) {
|
||||||
switch_.setRotX(35 * Mth.DEG_TO_RAD);
|
switch_.setRotX(35 * Mth.DEG_TO_RAD);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,8 +5,8 @@ import com.atsuishio.superbwarfare.client.AnimationHelper;
|
||||||
import com.atsuishio.superbwarfare.client.overlay.CrossHairOverlay;
|
import com.atsuishio.superbwarfare.client.overlay.CrossHairOverlay;
|
||||||
import com.atsuishio.superbwarfare.event.ClientEventHandler;
|
import com.atsuishio.superbwarfare.event.ClientEventHandler;
|
||||||
import com.atsuishio.superbwarfare.init.ModTags;
|
import com.atsuishio.superbwarfare.init.ModTags;
|
||||||
import com.atsuishio.superbwarfare.item.gun.data.AttachmentType;
|
|
||||||
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
||||||
|
import com.atsuishio.superbwarfare.item.gun.data.value.AttachmentType;
|
||||||
import com.atsuishio.superbwarfare.item.gun.rifle.Hk416Item;
|
import com.atsuishio.superbwarfare.item.gun.rifle.Hk416Item;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
@ -152,7 +152,7 @@ public class Hk416ItemModel extends GeoModel<Hk416Item> {
|
||||||
l.setRotX(rotXBipod * Mth.DEG_TO_RAD);
|
l.setRotX(rotXBipod * Mth.DEG_TO_RAD);
|
||||||
r.setRotX(rotXBipod * Mth.DEG_TO_RAD);
|
r.setRotX(rotXBipod * Mth.DEG_TO_RAD);
|
||||||
|
|
||||||
int mode = data.fireMode();
|
int mode = data.fireMode.get();
|
||||||
|
|
||||||
kuaimanji.setRotX(mode == 2 ? 90 * Mth.DEG_TO_RAD : 0);
|
kuaimanji.setRotX(mode == 2 ? 90 * Mth.DEG_TO_RAD : 0);
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ public class K98ItemModel extends GeoModel<K98Item> {
|
||||||
if (!stack.is(ModTags.Items.GUN)) return;
|
if (!stack.is(ModTags.Items.GUN)) return;
|
||||||
|
|
||||||
var data = GunData.from(stack);
|
var data = GunData.from(stack);
|
||||||
if (data.reload.prepareTimer.get() > 11 && data.ammo() == 1) {
|
if (data.reload.prepareTimer.get() > 11 && data.ammo.get() == 1) {
|
||||||
clip.setScaleX(0);
|
clip.setScaleX(0);
|
||||||
clip.setScaleY(0);
|
clip.setScaleY(0);
|
||||||
clip.setScaleZ(0);
|
clip.setScaleZ(0);
|
||||||
|
|
|
@ -5,8 +5,8 @@ import com.atsuishio.superbwarfare.client.AnimationHelper;
|
||||||
import com.atsuishio.superbwarfare.client.overlay.CrossHairOverlay;
|
import com.atsuishio.superbwarfare.client.overlay.CrossHairOverlay;
|
||||||
import com.atsuishio.superbwarfare.event.ClientEventHandler;
|
import com.atsuishio.superbwarfare.event.ClientEventHandler;
|
||||||
import com.atsuishio.superbwarfare.init.ModTags;
|
import com.atsuishio.superbwarfare.init.ModTags;
|
||||||
import com.atsuishio.superbwarfare.item.gun.data.AttachmentType;
|
|
||||||
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
||||||
|
import com.atsuishio.superbwarfare.item.gun.data.value.AttachmentType;
|
||||||
import com.atsuishio.superbwarfare.item.gun.rifle.M4Item;
|
import com.atsuishio.superbwarfare.item.gun.rifle.M4Item;
|
||||||
import com.atsuishio.superbwarfare.tools.NBTTool;
|
import com.atsuishio.superbwarfare.tools.NBTTool;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
|
|
@ -61,7 +61,7 @@ public class M60ItemModel extends GeoModel<M60Item> {
|
||||||
|
|
||||||
var data = GunData.from(stack);
|
var data = GunData.from(stack);
|
||||||
var tag = data.tag();
|
var tag = data.tag();
|
||||||
int ammo = data.ammo();
|
int ammo = data.ammo.get();
|
||||||
boolean flag = GunsTool.getGunBooleanTag(tag, "HideBulletChain");
|
boolean flag = GunsTool.getGunBooleanTag(tag, "HideBulletChain");
|
||||||
|
|
||||||
if (ammo < 5 && flag) {
|
if (ammo < 5 && flag) {
|
||||||
|
|
|
@ -83,7 +83,7 @@ public class MarlinItemModel extends GeoModel<MarlinItem> {
|
||||||
|
|
||||||
CrossHairOverlay.gunRot = shen.getRotZ();
|
CrossHairOverlay.gunRot = shen.getRotZ();
|
||||||
|
|
||||||
if (GunData.from(stack).isEmpty()) {
|
if (GunData.from(stack).isEmpty.get()) {
|
||||||
jichui.setRotX(-0.52f);
|
jichui.setRotX(-0.52f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,8 +5,8 @@ import com.atsuishio.superbwarfare.client.AnimationHelper;
|
||||||
import com.atsuishio.superbwarfare.client.overlay.CrossHairOverlay;
|
import com.atsuishio.superbwarfare.client.overlay.CrossHairOverlay;
|
||||||
import com.atsuishio.superbwarfare.event.ClientEventHandler;
|
import com.atsuishio.superbwarfare.event.ClientEventHandler;
|
||||||
import com.atsuishio.superbwarfare.init.ModTags;
|
import com.atsuishio.superbwarfare.init.ModTags;
|
||||||
import com.atsuishio.superbwarfare.item.gun.data.AttachmentType;
|
|
||||||
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
||||||
|
import com.atsuishio.superbwarfare.item.gun.data.value.AttachmentType;
|
||||||
import com.atsuishio.superbwarfare.item.gun.rifle.Mk14Item;
|
import com.atsuishio.superbwarfare.item.gun.rifle.Mk14Item;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
|
|
@ -121,7 +121,7 @@ public class MosinNagantItemModel extends GeoModel<MosinNagantItem> {
|
||||||
float numR = (float) (1 - 0.97 * zt);
|
float numR = (float) (1 - 0.97 * zt);
|
||||||
float numP = (float) (1 - 0.81 * zt);
|
float numP = (float) (1 - 0.81 * zt);
|
||||||
|
|
||||||
if (data.reloading() || data.bolt.actionTime() > 0) {
|
if (data.reloading() || data.bolt.actionTimer.get() > 0) {
|
||||||
main.setRotX(numR * main.getRotX());
|
main.setRotX(numR * main.getRotX());
|
||||||
main.setRotY(numR * main.getRotY());
|
main.setRotY(numR * main.getRotY());
|
||||||
main.setRotZ(numR * main.getRotZ());
|
main.setRotZ(numR * main.getRotZ());
|
||||||
|
|
|
@ -4,8 +4,8 @@ import com.atsuishio.superbwarfare.Mod;
|
||||||
import com.atsuishio.superbwarfare.client.overlay.CrossHairOverlay;
|
import com.atsuishio.superbwarfare.client.overlay.CrossHairOverlay;
|
||||||
import com.atsuishio.superbwarfare.event.ClientEventHandler;
|
import com.atsuishio.superbwarfare.event.ClientEventHandler;
|
||||||
import com.atsuishio.superbwarfare.init.ModTags;
|
import com.atsuishio.superbwarfare.init.ModTags;
|
||||||
import com.atsuishio.superbwarfare.item.gun.data.AttachmentType;
|
|
||||||
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
||||||
|
import com.atsuishio.superbwarfare.item.gun.data.value.AttachmentType;
|
||||||
import com.atsuishio.superbwarfare.item.gun.heavy.Ntw20Item;
|
import com.atsuishio.superbwarfare.item.gun.heavy.Ntw20Item;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
@ -157,7 +157,7 @@ public class Ntw20Model extends GeoModel<Ntw20Item> {
|
||||||
float numR = (float) (1 - 0.92 * zt);
|
float numR = (float) (1 - 0.92 * zt);
|
||||||
float numP = (float) (1 - 0.88 * zt);
|
float numP = (float) (1 - 0.88 * zt);
|
||||||
|
|
||||||
if (data.reload.time() > 0 || data.bolt.actionTime() > 0) {
|
if (data.reload.time() > 0 || data.bolt.actionTimer.get() > 0) {
|
||||||
main.setRotX(numR * main.getRotX());
|
main.setRotX(numR * main.getRotX());
|
||||||
main.setRotY(numR * main.getRotY());
|
main.setRotY(numR * main.getRotY());
|
||||||
main.setRotZ(numR * main.getRotZ());
|
main.setRotZ(numR * main.getRotZ());
|
||||||
|
|
|
@ -5,8 +5,8 @@ import com.atsuishio.superbwarfare.client.AnimationHelper;
|
||||||
import com.atsuishio.superbwarfare.client.overlay.CrossHairOverlay;
|
import com.atsuishio.superbwarfare.client.overlay.CrossHairOverlay;
|
||||||
import com.atsuishio.superbwarfare.event.ClientEventHandler;
|
import com.atsuishio.superbwarfare.event.ClientEventHandler;
|
||||||
import com.atsuishio.superbwarfare.init.ModTags;
|
import com.atsuishio.superbwarfare.init.ModTags;
|
||||||
import com.atsuishio.superbwarfare.item.gun.data.AttachmentType;
|
|
||||||
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
||||||
|
import com.atsuishio.superbwarfare.item.gun.data.value.AttachmentType;
|
||||||
import com.atsuishio.superbwarfare.item.gun.rifle.Qbz95Item;
|
import com.atsuishio.superbwarfare.item.gun.rifle.Qbz95Item;
|
||||||
import com.atsuishio.superbwarfare.tools.GunsTool;
|
import com.atsuishio.superbwarfare.tools.GunsTool;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
|
|
@ -45,7 +45,7 @@ public class RpgItemModel extends GeoModel<RpgItem> {
|
||||||
if (!stack.is(ModTags.Items.GUN)) return;
|
if (!stack.is(ModTags.Items.GUN)) return;
|
||||||
|
|
||||||
var data = GunData.from(stack);
|
var data = GunData.from(stack);
|
||||||
if (data.closeHammer()) {
|
if (data.closeHammer.get()) {
|
||||||
hammer.setRotX(-90 * Mth.DEG_TO_RAD);
|
hammer.setRotX(-90 * Mth.DEG_TO_RAD);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,8 +5,8 @@ import com.atsuishio.superbwarfare.client.AnimationHelper;
|
||||||
import com.atsuishio.superbwarfare.client.overlay.CrossHairOverlay;
|
import com.atsuishio.superbwarfare.client.overlay.CrossHairOverlay;
|
||||||
import com.atsuishio.superbwarfare.event.ClientEventHandler;
|
import com.atsuishio.superbwarfare.event.ClientEventHandler;
|
||||||
import com.atsuishio.superbwarfare.init.ModTags;
|
import com.atsuishio.superbwarfare.init.ModTags;
|
||||||
import com.atsuishio.superbwarfare.item.gun.data.AttachmentType;
|
|
||||||
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
||||||
|
import com.atsuishio.superbwarfare.item.gun.data.value.AttachmentType;
|
||||||
import com.atsuishio.superbwarfare.item.gun.machinegun.RpkItem;
|
import com.atsuishio.superbwarfare.item.gun.machinegun.RpkItem;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
|
|
@ -104,8 +104,8 @@ public class SentinelItemModel extends GeoModel<SentinelItem> {
|
||||||
root.setRotY((float) (0.2f * movePosX + Mth.DEG_TO_RAD * 300 * ClientEventHandler.drawTime + Mth.DEG_TO_RAD * turnRotY));
|
root.setRotY((float) (0.2f * movePosX + Mth.DEG_TO_RAD * 300 * ClientEventHandler.drawTime + Mth.DEG_TO_RAD * turnRotY));
|
||||||
root.setRotZ((float) (0.2f * movePosX + moveRotZ + Mth.DEG_TO_RAD * 90 * ClientEventHandler.drawTime + 2.7f * mph + Mth.DEG_TO_RAD * turnRotZ));
|
root.setRotZ((float) (0.2f * movePosX + moveRotZ + Mth.DEG_TO_RAD * 90 * ClientEventHandler.drawTime + 2.7f * mph + Mth.DEG_TO_RAD * turnRotZ));
|
||||||
|
|
||||||
if (data.ammo() <= 5) {
|
if (data.ammo.get() <= 5) {
|
||||||
ammo.setScaleX((float) data.ammo() / 5);
|
ammo.setScaleX((float) data.ammo.get() / 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
GeoBone camera = getAnimationProcessor().getBone("camera");
|
GeoBone camera = getAnimationProcessor().getBone("camera");
|
||||||
|
|
|
@ -5,8 +5,8 @@ import com.atsuishio.superbwarfare.client.AnimationHelper;
|
||||||
import com.atsuishio.superbwarfare.client.overlay.CrossHairOverlay;
|
import com.atsuishio.superbwarfare.client.overlay.CrossHairOverlay;
|
||||||
import com.atsuishio.superbwarfare.event.ClientEventHandler;
|
import com.atsuishio.superbwarfare.event.ClientEventHandler;
|
||||||
import com.atsuishio.superbwarfare.init.ModTags;
|
import com.atsuishio.superbwarfare.init.ModTags;
|
||||||
import com.atsuishio.superbwarfare.item.gun.data.AttachmentType;
|
|
||||||
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
||||||
|
import com.atsuishio.superbwarfare.item.gun.data.value.AttachmentType;
|
||||||
import com.atsuishio.superbwarfare.item.gun.sniper.SvdItem;
|
import com.atsuishio.superbwarfare.item.gun.sniper.SvdItem;
|
||||||
import com.atsuishio.superbwarfare.tools.GunsTool;
|
import com.atsuishio.superbwarfare.tools.GunsTool;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
|
|
@ -5,8 +5,8 @@ import com.atsuishio.superbwarfare.client.AnimationHelper;
|
||||||
import com.atsuishio.superbwarfare.client.overlay.CrossHairOverlay;
|
import com.atsuishio.superbwarfare.client.overlay.CrossHairOverlay;
|
||||||
import com.atsuishio.superbwarfare.event.ClientEventHandler;
|
import com.atsuishio.superbwarfare.event.ClientEventHandler;
|
||||||
import com.atsuishio.superbwarfare.init.ModTags;
|
import com.atsuishio.superbwarfare.init.ModTags;
|
||||||
import com.atsuishio.superbwarfare.item.gun.data.AttachmentType;
|
|
||||||
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
||||||
|
import com.atsuishio.superbwarfare.item.gun.data.value.AttachmentType;
|
||||||
import com.atsuishio.superbwarfare.item.gun.handgun.Trachelium;
|
import com.atsuishio.superbwarfare.item.gun.handgun.Trachelium;
|
||||||
import com.atsuishio.superbwarfare.tools.NBTTool;
|
import com.atsuishio.superbwarfare.tools.NBTTool;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
@ -169,7 +169,7 @@ public class TracheliumItemModel extends GeoModel<Trachelium> {
|
||||||
GeoBone root = getAnimationProcessor().getBone("root");
|
GeoBone root = getAnimationProcessor().getBone("root");
|
||||||
root.setPosX((float) (movePosX + 20 * ClientEventHandler.drawTime + 9.3f * mph));
|
root.setPosX((float) (movePosX + 20 * ClientEventHandler.drawTime + 9.3f * mph));
|
||||||
root.setPosY((float) (swayY + movePosY - 40 * ClientEventHandler.drawTime - 2f * vY));
|
root.setPosY((float) (swayY + movePosY - 40 * ClientEventHandler.drawTime - 2f * vY));
|
||||||
root.setPosZ(!GunData.from(stack).DA() && !GunData.from(stack).canImmediatelyShoot() ? 0.2f * (float) ClientEventHandler.revolverPreTime : 0);
|
root.setPosZ(!GunData.from(stack).DA.get() && !GunData.from(stack).canImmediatelyShoot.get() ? 0.2f * (float) ClientEventHandler.revolverPreTime : 0);
|
||||||
root.setRotX((float) ((swayX - Mth.DEG_TO_RAD * 60 * ClientEventHandler.drawTime + Mth.DEG_TO_RAD * turnRotX - 0.15f * vY)));
|
root.setRotX((float) ((swayX - Mth.DEG_TO_RAD * 60 * ClientEventHandler.drawTime + Mth.DEG_TO_RAD * turnRotX - 0.15f * vY)));
|
||||||
root.setRotY((float) (0.2f * movePosX + Mth.DEG_TO_RAD * 300 * ClientEventHandler.drawTime + Mth.DEG_TO_RAD * turnRotY));
|
root.setRotY((float) (0.2f * movePosX + Mth.DEG_TO_RAD * 300 * ClientEventHandler.drawTime + Mth.DEG_TO_RAD * turnRotY));
|
||||||
root.setRotZ((float) (0.2f * movePosX + moveRotZ + Mth.DEG_TO_RAD * 90 * ClientEventHandler.drawTime + 2.7f * mph + Mth.DEG_TO_RAD * turnRotZ));
|
root.setRotZ((float) (0.2f * movePosX + moveRotZ + Mth.DEG_TO_RAD * 90 * ClientEventHandler.drawTime + 2.7f * mph + Mth.DEG_TO_RAD * turnRotZ));
|
||||||
|
|
|
@ -5,8 +5,8 @@ import com.atsuishio.superbwarfare.client.AnimationHelper;
|
||||||
import com.atsuishio.superbwarfare.client.overlay.CrossHairOverlay;
|
import com.atsuishio.superbwarfare.client.overlay.CrossHairOverlay;
|
||||||
import com.atsuishio.superbwarfare.event.ClientEventHandler;
|
import com.atsuishio.superbwarfare.event.ClientEventHandler;
|
||||||
import com.atsuishio.superbwarfare.init.ModTags;
|
import com.atsuishio.superbwarfare.init.ModTags;
|
||||||
import com.atsuishio.superbwarfare.item.gun.data.AttachmentType;
|
|
||||||
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
||||||
|
import com.atsuishio.superbwarfare.item.gun.data.value.AttachmentType;
|
||||||
import com.atsuishio.superbwarfare.item.gun.smg.VectorItem;
|
import com.atsuishio.superbwarfare.item.gun.smg.VectorItem;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
@ -57,7 +57,7 @@ public class VectorItemModel extends GeoModel<VectorItem> {
|
||||||
|
|
||||||
var data = GunData.from(stack);
|
var data = GunData.from(stack);
|
||||||
var tag = data.tag();
|
var tag = data.tag();
|
||||||
int mode = data.fireMode();
|
int mode = data.fireMode.get();
|
||||||
if (mode == 0) {
|
if (mode == 0) {
|
||||||
kmj.setRotX(-120 * Mth.DEG_TO_RAD);
|
kmj.setRotX(-120 * Mth.DEG_TO_RAD);
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,10 +52,10 @@ public class AmmoBarOverlay implements LayeredDraw.Layer {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getItem() == ModItems.BOCEK.get()) {
|
if (stack.getItem() == ModItems.BOCEK.get()) {
|
||||||
return GunData.from(stack).maxAmmo();
|
return GunData.from(stack).maxAmmo.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
return GunData.from(stack).ammo();
|
return GunData.from(stack).ammo.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String getPlayerAmmoCount(Player player) {
|
private static String getPlayerAmmoCount(Player player) {
|
||||||
|
@ -69,7 +69,7 @@ public class AmmoBarOverlay implements LayeredDraw.Layer {
|
||||||
if (!hasCreativeAmmo()) {
|
if (!hasCreativeAmmo()) {
|
||||||
var data = GunData.from(stack);
|
var data = GunData.from(stack);
|
||||||
if (stack.is(ModTags.Items.LAUNCHER) || stack.getItem() == ModItems.TASER.get()) {
|
if (stack.is(ModTags.Items.LAUNCHER) || stack.getItem() == ModItems.TASER.get()) {
|
||||||
return "" + data.maxAmmo();
|
return "" + data.maxAmmo.get();
|
||||||
}
|
}
|
||||||
if (stack.is(ModTags.Items.USE_RIFLE_AMMO)) {
|
if (stack.is(ModTags.Items.USE_RIFLE_AMMO)) {
|
||||||
return "" + cap.rifleAmmo;
|
return "" + cap.rifleAmmo;
|
||||||
|
@ -175,7 +175,7 @@ public class AmmoBarOverlay implements LayeredDraw.Layer {
|
||||||
} else {
|
} else {
|
||||||
guiGraphics.drawString(
|
guiGraphics.drawString(
|
||||||
Minecraft.getInstance().font,
|
Minecraft.getInstance().font,
|
||||||
data.DA() ? Component.translatable("des.superbwarfare.revolver.sa").withStyle(ChatFormatting.BOLD) : Component.translatable("des.superbwarfare.revolver.da").withStyle(ChatFormatting.BOLD),
|
data.DA.get() ? Component.translatable("des.superbwarfare.revolver.sa").withStyle(ChatFormatting.BOLD) : Component.translatable("des.superbwarfare.revolver.da").withStyle(ChatFormatting.BOLD),
|
||||||
w - 96,
|
w - 96,
|
||||||
h - 20,
|
h - 20,
|
||||||
0xFFFFFF,
|
0xFFFFFF,
|
||||||
|
@ -262,7 +262,7 @@ public class AmmoBarOverlay implements LayeredDraw.Layer {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ResourceLocation getFireMode(GunData data) {
|
private static ResourceLocation getFireMode(GunData data) {
|
||||||
return switch (data.fireMode()) {
|
return switch (data.fireMode.get()) {
|
||||||
case 1 -> BURST;
|
case 1 -> BURST;
|
||||||
case 2 -> AUTO;
|
case 2 -> AUTO;
|
||||||
default -> SEMI;
|
default -> SEMI;
|
||||||
|
|
|
@ -82,7 +82,7 @@ public class JavelinHudOverlay implements LayeredDraw.Layer {
|
||||||
float j1 = l + j;
|
float j1 = l + j;
|
||||||
preciseBlit(guiGraphics, Mod.loc("textures/screens/javelin/javelin_hud.png"), k, l, 0, 0.0F, i, j, i, j);
|
preciseBlit(guiGraphics, Mod.loc("textures/screens/javelin/javelin_hud.png"), k, l, 0, 0.0F, i, j, i, j);
|
||||||
preciseBlit(guiGraphics, Mod.loc(tag.getBoolean("TopMode") ? "textures/screens/javelin/top.png" : "textures/screens/javelin/dir.png"), k, l, 0, 0.0F, i, j, i, j);
|
preciseBlit(guiGraphics, Mod.loc(tag.getBoolean("TopMode") ? "textures/screens/javelin/top.png" : "textures/screens/javelin/dir.png"), k, l, 0, 0.0F, i, j, i, j);
|
||||||
preciseBlit(guiGraphics, Mod.loc(data.ammo() > 0 ? "textures/screens/javelin/missile_green.png" : "textures/screens/javelin/missile_red.png"), k, l, 0, 0.0F, i, j, i, j);
|
preciseBlit(guiGraphics, Mod.loc(data.ammo.get() > 0 ? "textures/screens/javelin/missile_green.png" : "textures/screens/javelin/missile_red.png"), k, l, 0, 0.0F, i, j, i, j);
|
||||||
if (tag.getInt("SeekTime") > 1 && tag.getInt("SeekTime") < 20) {
|
if (tag.getInt("SeekTime") > 1 && tag.getInt("SeekTime") < 20) {
|
||||||
preciseBlit(guiGraphics, Mod.loc("textures/screens/javelin/seek.png"), k, l, 0, 0.0F, i, j, i, j);
|
preciseBlit(guiGraphics, Mod.loc("textures/screens/javelin/seek.png"), k, l, 0, 0.0F, i, j, i, j);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,10 +5,9 @@ import com.atsuishio.superbwarfare.client.ItemModelHelper;
|
||||||
import com.atsuishio.superbwarfare.client.model.item.AK12ItemModel;
|
import com.atsuishio.superbwarfare.client.model.item.AK12ItemModel;
|
||||||
import com.atsuishio.superbwarfare.event.ClientEventHandler;
|
import com.atsuishio.superbwarfare.event.ClientEventHandler;
|
||||||
import com.atsuishio.superbwarfare.init.ModTags;
|
import com.atsuishio.superbwarfare.init.ModTags;
|
||||||
import com.atsuishio.superbwarfare.item.gun.data.AttachmentType;
|
|
||||||
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
||||||
|
import com.atsuishio.superbwarfare.item.gun.data.value.AttachmentType;
|
||||||
import com.atsuishio.superbwarfare.item.gun.rifle.AK12Item;
|
import com.atsuishio.superbwarfare.item.gun.rifle.AK12Item;
|
||||||
import com.atsuishio.superbwarfare.tools.NBTTool;
|
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
|
|
@ -5,10 +5,9 @@ import com.atsuishio.superbwarfare.client.ItemModelHelper;
|
||||||
import com.atsuishio.superbwarfare.client.model.item.AK47ItemModel;
|
import com.atsuishio.superbwarfare.client.model.item.AK47ItemModel;
|
||||||
import com.atsuishio.superbwarfare.event.ClientEventHandler;
|
import com.atsuishio.superbwarfare.event.ClientEventHandler;
|
||||||
import com.atsuishio.superbwarfare.init.ModTags;
|
import com.atsuishio.superbwarfare.init.ModTags;
|
||||||
import com.atsuishio.superbwarfare.item.gun.data.AttachmentType;
|
|
||||||
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
||||||
|
import com.atsuishio.superbwarfare.item.gun.data.value.AttachmentType;
|
||||||
import com.atsuishio.superbwarfare.item.gun.rifle.AK47Item;
|
import com.atsuishio.superbwarfare.item.gun.rifle.AK47Item;
|
||||||
import com.atsuishio.superbwarfare.tools.NBTTool;
|
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
|
|
@ -5,8 +5,8 @@ import com.atsuishio.superbwarfare.client.ItemModelHelper;
|
||||||
import com.atsuishio.superbwarfare.client.model.item.Aa12ItemModel;
|
import com.atsuishio.superbwarfare.client.model.item.Aa12ItemModel;
|
||||||
import com.atsuishio.superbwarfare.event.ClientEventHandler;
|
import com.atsuishio.superbwarfare.event.ClientEventHandler;
|
||||||
import com.atsuishio.superbwarfare.init.ModTags;
|
import com.atsuishio.superbwarfare.init.ModTags;
|
||||||
import com.atsuishio.superbwarfare.item.gun.data.AttachmentType;
|
|
||||||
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
||||||
|
import com.atsuishio.superbwarfare.item.gun.data.value.AttachmentType;
|
||||||
import com.atsuishio.superbwarfare.item.gun.shotgun.Aa12Item;
|
import com.atsuishio.superbwarfare.item.gun.shotgun.Aa12Item;
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||||
|
|
|
@ -91,7 +91,7 @@ public class BocekItemRenderer extends GeoItemRenderer<BocekItem> {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (name.equals("jian")) {
|
if (name.equals("jian")) {
|
||||||
bone.setHidden(GunData.from(itemStack).maxAmmo() == 0);
|
bone.setHidden(GunData.from(itemStack).maxAmmo.get() == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (renderingArms) {
|
if (renderingArms) {
|
||||||
|
|
|
@ -5,8 +5,8 @@ import com.atsuishio.superbwarfare.client.ItemModelHelper;
|
||||||
import com.atsuishio.superbwarfare.client.model.item.Hk416ItemModel;
|
import com.atsuishio.superbwarfare.client.model.item.Hk416ItemModel;
|
||||||
import com.atsuishio.superbwarfare.event.ClientEventHandler;
|
import com.atsuishio.superbwarfare.event.ClientEventHandler;
|
||||||
import com.atsuishio.superbwarfare.init.ModTags;
|
import com.atsuishio.superbwarfare.init.ModTags;
|
||||||
import com.atsuishio.superbwarfare.item.gun.data.AttachmentType;
|
|
||||||
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
||||||
|
import com.atsuishio.superbwarfare.item.gun.data.value.AttachmentType;
|
||||||
import com.atsuishio.superbwarfare.item.gun.rifle.Hk416Item;
|
import com.atsuishio.superbwarfare.item.gun.rifle.Hk416Item;
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||||
|
|
|
@ -4,10 +4,9 @@ import com.atsuishio.superbwarfare.client.AnimationHelper;
|
||||||
import com.atsuishio.superbwarfare.client.model.item.InsidiousItemModel;
|
import com.atsuishio.superbwarfare.client.model.item.InsidiousItemModel;
|
||||||
import com.atsuishio.superbwarfare.event.ClientEventHandler;
|
import com.atsuishio.superbwarfare.event.ClientEventHandler;
|
||||||
import com.atsuishio.superbwarfare.init.ModTags;
|
import com.atsuishio.superbwarfare.init.ModTags;
|
||||||
import com.atsuishio.superbwarfare.item.gun.data.AttachmentType;
|
|
||||||
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
||||||
|
import com.atsuishio.superbwarfare.item.gun.data.value.AttachmentType;
|
||||||
import com.atsuishio.superbwarfare.item.gun.rifle.InsidiousItem;
|
import com.atsuishio.superbwarfare.item.gun.rifle.InsidiousItem;
|
||||||
import com.atsuishio.superbwarfare.tools.NBTTool;
|
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
|
|
@ -5,8 +5,8 @@ import com.atsuishio.superbwarfare.client.ItemModelHelper;
|
||||||
import com.atsuishio.superbwarfare.client.model.item.M4ItemModel;
|
import com.atsuishio.superbwarfare.client.model.item.M4ItemModel;
|
||||||
import com.atsuishio.superbwarfare.event.ClientEventHandler;
|
import com.atsuishio.superbwarfare.event.ClientEventHandler;
|
||||||
import com.atsuishio.superbwarfare.init.ModTags;
|
import com.atsuishio.superbwarfare.init.ModTags;
|
||||||
import com.atsuishio.superbwarfare.item.gun.data.AttachmentType;
|
|
||||||
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
||||||
|
import com.atsuishio.superbwarfare.item.gun.data.value.AttachmentType;
|
||||||
import com.atsuishio.superbwarfare.item.gun.rifle.M4Item;
|
import com.atsuishio.superbwarfare.item.gun.rifle.M4Item;
|
||||||
import com.atsuishio.superbwarfare.tools.NBTTool;
|
import com.atsuishio.superbwarfare.tools.NBTTool;
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
|
|
|
@ -5,10 +5,9 @@ import com.atsuishio.superbwarfare.client.ItemModelHelper;
|
||||||
import com.atsuishio.superbwarfare.client.model.item.Mk14ItemModel;
|
import com.atsuishio.superbwarfare.client.model.item.Mk14ItemModel;
|
||||||
import com.atsuishio.superbwarfare.event.ClientEventHandler;
|
import com.atsuishio.superbwarfare.event.ClientEventHandler;
|
||||||
import com.atsuishio.superbwarfare.init.ModTags;
|
import com.atsuishio.superbwarfare.init.ModTags;
|
||||||
import com.atsuishio.superbwarfare.item.gun.data.AttachmentType;
|
|
||||||
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
||||||
|
import com.atsuishio.superbwarfare.item.gun.data.value.AttachmentType;
|
||||||
import com.atsuishio.superbwarfare.item.gun.rifle.Mk14Item;
|
import com.atsuishio.superbwarfare.item.gun.rifle.Mk14Item;
|
||||||
import com.atsuishio.superbwarfare.tools.NBTTool;
|
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
|
|
@ -5,10 +5,9 @@ import com.atsuishio.superbwarfare.client.ItemModelHelper;
|
||||||
import com.atsuishio.superbwarfare.client.model.item.Ntw20Model;
|
import com.atsuishio.superbwarfare.client.model.item.Ntw20Model;
|
||||||
import com.atsuishio.superbwarfare.event.ClientEventHandler;
|
import com.atsuishio.superbwarfare.event.ClientEventHandler;
|
||||||
import com.atsuishio.superbwarfare.init.ModTags;
|
import com.atsuishio.superbwarfare.init.ModTags;
|
||||||
import com.atsuishio.superbwarfare.item.gun.data.AttachmentType;
|
|
||||||
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
||||||
|
import com.atsuishio.superbwarfare.item.gun.data.value.AttachmentType;
|
||||||
import com.atsuishio.superbwarfare.item.gun.heavy.Ntw20Item;
|
import com.atsuishio.superbwarfare.item.gun.heavy.Ntw20Item;
|
||||||
import com.atsuishio.superbwarfare.tools.NBTTool;
|
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
|
|
@ -5,10 +5,9 @@ import com.atsuishio.superbwarfare.client.ItemModelHelper;
|
||||||
import com.atsuishio.superbwarfare.client.model.item.Qbz95ItemModel;
|
import com.atsuishio.superbwarfare.client.model.item.Qbz95ItemModel;
|
||||||
import com.atsuishio.superbwarfare.event.ClientEventHandler;
|
import com.atsuishio.superbwarfare.event.ClientEventHandler;
|
||||||
import com.atsuishio.superbwarfare.init.ModTags;
|
import com.atsuishio.superbwarfare.init.ModTags;
|
||||||
import com.atsuishio.superbwarfare.item.gun.data.AttachmentType;
|
|
||||||
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
||||||
|
import com.atsuishio.superbwarfare.item.gun.data.value.AttachmentType;
|
||||||
import com.atsuishio.superbwarfare.item.gun.rifle.Qbz95Item;
|
import com.atsuishio.superbwarfare.item.gun.rifle.Qbz95Item;
|
||||||
import com.atsuishio.superbwarfare.tools.NBTTool;
|
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
|
|
@ -78,7 +78,7 @@ public class RpgItemRenderer extends GeoItemRenderer<RpgItem> {
|
||||||
if (!itemStack.is(ModTags.Items.GUN)) return;
|
if (!itemStack.is(ModTags.Items.GUN)) return;
|
||||||
|
|
||||||
if (name.equals("Rockets")) {
|
if (name.equals("Rockets")) {
|
||||||
bone.setHidden(GunData.from(itemStack).isEmpty());
|
bone.setHidden(GunData.from(itemStack).isEmpty.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (name.equals("flare")) {
|
if (name.equals("flare")) {
|
||||||
|
|
|
@ -5,10 +5,9 @@ import com.atsuishio.superbwarfare.client.ItemModelHelper;
|
||||||
import com.atsuishio.superbwarfare.client.model.item.RpkItemModel;
|
import com.atsuishio.superbwarfare.client.model.item.RpkItemModel;
|
||||||
import com.atsuishio.superbwarfare.event.ClientEventHandler;
|
import com.atsuishio.superbwarfare.event.ClientEventHandler;
|
||||||
import com.atsuishio.superbwarfare.init.ModTags;
|
import com.atsuishio.superbwarfare.init.ModTags;
|
||||||
import com.atsuishio.superbwarfare.item.gun.data.AttachmentType;
|
|
||||||
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
||||||
|
import com.atsuishio.superbwarfare.item.gun.data.value.AttachmentType;
|
||||||
import com.atsuishio.superbwarfare.item.gun.machinegun.RpkItem;
|
import com.atsuishio.superbwarfare.item.gun.machinegun.RpkItem;
|
||||||
import com.atsuishio.superbwarfare.tools.GunsTool;
|
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
|
|
@ -5,10 +5,9 @@ import com.atsuishio.superbwarfare.client.ItemModelHelper;
|
||||||
import com.atsuishio.superbwarfare.client.model.item.SvdItemModel;
|
import com.atsuishio.superbwarfare.client.model.item.SvdItemModel;
|
||||||
import com.atsuishio.superbwarfare.event.ClientEventHandler;
|
import com.atsuishio.superbwarfare.event.ClientEventHandler;
|
||||||
import com.atsuishio.superbwarfare.init.ModTags;
|
import com.atsuishio.superbwarfare.init.ModTags;
|
||||||
import com.atsuishio.superbwarfare.item.gun.data.AttachmentType;
|
|
||||||
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
||||||
|
import com.atsuishio.superbwarfare.item.gun.data.value.AttachmentType;
|
||||||
import com.atsuishio.superbwarfare.item.gun.sniper.SvdItem;
|
import com.atsuishio.superbwarfare.item.gun.sniper.SvdItem;
|
||||||
import com.atsuishio.superbwarfare.tools.NBTTool;
|
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
|
|
@ -5,8 +5,8 @@ import com.atsuishio.superbwarfare.client.ItemModelHelper;
|
||||||
import com.atsuishio.superbwarfare.client.model.item.TracheliumItemModel;
|
import com.atsuishio.superbwarfare.client.model.item.TracheliumItemModel;
|
||||||
import com.atsuishio.superbwarfare.event.ClientEventHandler;
|
import com.atsuishio.superbwarfare.event.ClientEventHandler;
|
||||||
import com.atsuishio.superbwarfare.init.ModTags;
|
import com.atsuishio.superbwarfare.init.ModTags;
|
||||||
import com.atsuishio.superbwarfare.item.gun.data.AttachmentType;
|
|
||||||
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
||||||
|
import com.atsuishio.superbwarfare.item.gun.data.value.AttachmentType;
|
||||||
import com.atsuishio.superbwarfare.item.gun.handgun.Trachelium;
|
import com.atsuishio.superbwarfare.item.gun.handgun.Trachelium;
|
||||||
import com.atsuishio.superbwarfare.tools.NBTTool;
|
import com.atsuishio.superbwarfare.tools.NBTTool;
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
|
|
|
@ -5,10 +5,9 @@ import com.atsuishio.superbwarfare.client.ItemModelHelper;
|
||||||
import com.atsuishio.superbwarfare.client.model.item.VectorItemModel;
|
import com.atsuishio.superbwarfare.client.model.item.VectorItemModel;
|
||||||
import com.atsuishio.superbwarfare.event.ClientEventHandler;
|
import com.atsuishio.superbwarfare.event.ClientEventHandler;
|
||||||
import com.atsuishio.superbwarfare.init.ModTags;
|
import com.atsuishio.superbwarfare.init.ModTags;
|
||||||
import com.atsuishio.superbwarfare.item.gun.data.AttachmentType;
|
|
||||||
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
||||||
|
import com.atsuishio.superbwarfare.item.gun.data.value.AttachmentType;
|
||||||
import com.atsuishio.superbwarfare.item.gun.smg.VectorItem;
|
import com.atsuishio.superbwarfare.item.gun.smg.VectorItem;
|
||||||
import com.atsuishio.superbwarfare.tools.NBTTool;
|
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
|
|
@ -124,8 +124,8 @@ public class ClientGunImageTooltip implements ClientTooltipComponent {
|
||||||
* 获取武器等级文本组件
|
* 获取武器等级文本组件
|
||||||
*/
|
*/
|
||||||
protected Component getLevelComponent() {
|
protected Component getLevelComponent() {
|
||||||
int level = data.level();
|
int level = data.level.get();
|
||||||
double rate = data.exp() / (20 * Math.pow(level, 2) + 160 * level + 20);
|
double rate = data.exp.get() / (20 * Math.pow(level, 2) + 160 * level + 20);
|
||||||
|
|
||||||
ChatFormatting formatting;
|
ChatFormatting formatting;
|
||||||
if (level < 10) {
|
if (level < 10) {
|
||||||
|
@ -151,7 +151,7 @@ public class ClientGunImageTooltip implements ClientTooltipComponent {
|
||||||
* 获取武器强化点数文本组件
|
* 获取武器强化点数文本组件
|
||||||
*/
|
*/
|
||||||
protected Component getUpgradePointComponent() {
|
protected Component getUpgradePointComponent() {
|
||||||
int upgradePoint = Mth.floor(data.upgradePoint());
|
int upgradePoint = Mth.floor(data.upgradePoint.get());
|
||||||
return Component.translatable("des.superbwarfare.guns.upgrade_point").withStyle(ChatFormatting.GRAY)
|
return Component.translatable("des.superbwarfare.guns.upgrade_point").withStyle(ChatFormatting.GRAY)
|
||||||
.append(Component.literal("").withStyle(ChatFormatting.RESET))
|
.append(Component.literal("").withStyle(ChatFormatting.RESET))
|
||||||
.append(Component.literal(String.valueOf(upgradePoint)).withStyle(ChatFormatting.WHITE).withStyle(ChatFormatting.BOLD));
|
.append(Component.literal(String.valueOf(upgradePoint)).withStyle(ChatFormatting.WHITE).withStyle(ChatFormatting.BOLD));
|
||||||
|
|
|
@ -10,8 +10,8 @@ import com.atsuishio.superbwarfare.entity.vehicle.base.VehicleEntity;
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.base.WeaponVehicleEntity;
|
import com.atsuishio.superbwarfare.entity.vehicle.base.WeaponVehicleEntity;
|
||||||
import com.atsuishio.superbwarfare.init.*;
|
import com.atsuishio.superbwarfare.init.*;
|
||||||
import com.atsuishio.superbwarfare.item.gun.GunItem;
|
import com.atsuishio.superbwarfare.item.gun.GunItem;
|
||||||
import com.atsuishio.superbwarfare.item.gun.data.AttachmentType;
|
|
||||||
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
||||||
|
import com.atsuishio.superbwarfare.item.gun.data.value.AttachmentType;
|
||||||
import com.atsuishio.superbwarfare.network.message.send.*;
|
import com.atsuishio.superbwarfare.network.message.send.*;
|
||||||
import com.atsuishio.superbwarfare.perk.AmmoPerk;
|
import com.atsuishio.superbwarfare.perk.AmmoPerk;
|
||||||
import com.atsuishio.superbwarfare.perk.Perk;
|
import com.atsuishio.superbwarfare.perk.Perk;
|
||||||
|
@ -200,7 +200,7 @@ public class ClientEventHandler {
|
||||||
ItemStack stack = player.getMainHandItem();
|
ItemStack stack = player.getMainHandItem();
|
||||||
if (!stack.is(ModTags.Items.REVOLVER)) {
|
if (!stack.is(ModTags.Items.REVOLVER)) {
|
||||||
return true;
|
return true;
|
||||||
} else if (stack.is(ModTags.Items.REVOLVER) && (data.DA() || data.canImmediatelyShoot())) {
|
} else if (stack.is(ModTags.Items.REVOLVER) && (data.DA.get() || data.canImmediatelyShoot.get())) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return revolverPreTime >= 1;
|
return revolverPreTime >= 1;
|
||||||
|
@ -489,7 +489,7 @@ public class ClientEventHandler {
|
||||||
final var tag = data.tag();
|
final var tag = data.tag();
|
||||||
|
|
||||||
var perk = data.perk.get(Perk.Type.AMMO);
|
var perk = data.perk.get(Perk.Type.AMMO);
|
||||||
int mode = data.fireMode();
|
int mode = data.fireMode.get();
|
||||||
|
|
||||||
// 精准度
|
// 精准度
|
||||||
float times = (float) Math.min(Minecraft.getInstance().getTimer().getRealtimeDeltaTicks(), 0.8);
|
float times = (float) Math.min(Minecraft.getInstance().getTimer().getRealtimeDeltaTicks(), 0.8);
|
||||||
|
@ -548,11 +548,11 @@ public class ClientEventHandler {
|
||||||
int cooldown = (int) (1000 / rps);
|
int cooldown = (int) (1000 / rps);
|
||||||
|
|
||||||
//左轮类
|
//左轮类
|
||||||
if (clientTimer.getProgress() == 0 && stack.is(ModTags.Items.REVOLVER) && ((holdFire && !data.DA())
|
if (clientTimer.getProgress() == 0 && stack.is(ModTags.Items.REVOLVER) && ((holdFire && !data.DA.get())
|
||||||
|| (data.bolt.actionTime() < 7 && data.bolt.actionTime() > 2) || data.canImmediatelyShoot())) {
|
|| (data.bolt.actionTimer.get() < 7 && data.bolt.actionTimer.get() > 2) || data.canImmediatelyShoot.get())) {
|
||||||
revolverPreTime = Mth.clamp(revolverPreTime + 0.3 * times, 0, 1);
|
revolverPreTime = Mth.clamp(revolverPreTime + 0.3 * times, 0, 1);
|
||||||
revolverWheelPreTime = Mth.clamp(revolverWheelPreTime + 0.32 * times, 0, revolverPreTime > 0.7 ? 1 : 0.55);
|
revolverWheelPreTime = Mth.clamp(revolverWheelPreTime + 0.32 * times, 0, revolverPreTime > 0.7 ? 1 : 0.55);
|
||||||
} else if (!data.DA() && !data.canImmediatelyShoot()) {
|
} else if (!data.DA.get() && !data.canImmediatelyShoot.get()) {
|
||||||
revolverPreTime = Mth.clamp(revolverPreTime - 1.2 * times, 0, 1);
|
revolverPreTime = Mth.clamp(revolverPreTime - 1.2 * times, 0, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -569,9 +569,9 @@ public class ClientEventHandler {
|
||||||
&& (!(data.reload.normal() || data.reload.empty())
|
&& (!(data.reload.normal() || data.reload.empty())
|
||||||
&& !data.reloading()
|
&& !data.reloading()
|
||||||
&& !data.charging()
|
&& !data.charging()
|
||||||
&& data.ammo() > 0
|
&& data.ammo.get() > 0
|
||||||
&& !player.getCooldowns().isOnCooldown(stack.getItem())
|
&& !player.getCooldowns().isOnCooldown(stack.getItem())
|
||||||
&& !data.bolt.needed()
|
&& !data.bolt.needed.get()
|
||||||
&& revolverPre(data))
|
&& revolverPre(data))
|
||||||
|| (stack.is(ModItems.MINIGUN.get())
|
|| (stack.is(ModItems.MINIGUN.get())
|
||||||
&& !player.isSprinting()
|
&& !player.isSprinting()
|
||||||
|
@ -646,14 +646,14 @@ public class ClientEventHandler {
|
||||||
ItemStack stack = player.getMainHandItem();
|
ItemStack stack = player.getMainHandItem();
|
||||||
var data = GunData.from(stack);
|
var data = GunData.from(stack);
|
||||||
if (stack.is(ModTags.Items.NORMAL_GUN)) {
|
if (stack.is(ModTags.Items.NORMAL_GUN)) {
|
||||||
if (data.ammo() > 0) {
|
if (data.ammo.get() > 0) {
|
||||||
int mode = data.fireMode();
|
int mode = data.fireMode.get();
|
||||||
if (mode != 2) {
|
if (mode != 2) {
|
||||||
holdFire = false;
|
holdFire = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mode == 1) {
|
if (mode == 1) {
|
||||||
if (data.ammo() == 1) {
|
if (data.ammo.get() == 1) {
|
||||||
burstFireAmount = 1;
|
burstFireAmount = 1;
|
||||||
}
|
}
|
||||||
if (burstFireAmount == 1) {
|
if (burstFireAmount == 1) {
|
||||||
|
@ -679,8 +679,8 @@ public class ClientEventHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 判断是否为栓动武器(BoltActionTime > 0),并在开火后给一个需要上膛的状态
|
// 判断是否为栓动武器(BoltActionTime > 0),并在开火后给一个需要上膛的状态
|
||||||
if (data.bolt.defaultActionTime() > 0 && data.ammo() > (stack.is(ModTags.Items.REVOLVER) ? 0 : 1)) {
|
if (data.defaultActionTime() > 0 && data.ammo.get() > (stack.is(ModTags.Items.REVOLVER) ? 0 : 1)) {
|
||||||
data.bolt.markNeeded();
|
data.bolt.needed.set(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
revolverPreTime = 0;
|
revolverPreTime = 0;
|
||||||
|
|
|
@ -5,9 +5,9 @@ import com.atsuishio.superbwarfare.entity.projectile.ProjectileEntity;
|
||||||
import com.atsuishio.superbwarfare.event.events.ReloadEvent;
|
import com.atsuishio.superbwarfare.event.events.ReloadEvent;
|
||||||
import com.atsuishio.superbwarfare.init.*;
|
import com.atsuishio.superbwarfare.init.*;
|
||||||
import com.atsuishio.superbwarfare.item.gun.GunItem;
|
import com.atsuishio.superbwarfare.item.gun.GunItem;
|
||||||
import com.atsuishio.superbwarfare.item.gun.data.AttachmentType;
|
|
||||||
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
||||||
import com.atsuishio.superbwarfare.item.gun.data.ReloadState;
|
import com.atsuishio.superbwarfare.item.gun.data.value.AttachmentType;
|
||||||
|
import com.atsuishio.superbwarfare.item.gun.data.value.ReloadState;
|
||||||
import com.atsuishio.superbwarfare.perk.AmmoPerk;
|
import com.atsuishio.superbwarfare.perk.AmmoPerk;
|
||||||
import com.atsuishio.superbwarfare.perk.Perk;
|
import com.atsuishio.superbwarfare.perk.Perk;
|
||||||
import com.atsuishio.superbwarfare.tools.AmmoType;
|
import com.atsuishio.superbwarfare.tools.AmmoType;
|
||||||
|
@ -60,18 +60,18 @@ public class GunEventHandler {
|
||||||
var stack = data.stack();
|
var stack = data.stack();
|
||||||
|
|
||||||
if (stack.is(ModTags.Items.NORMAL_GUN)) {
|
if (stack.is(ModTags.Items.NORMAL_GUN)) {
|
||||||
if (data.bolt.actionTime() > 0) {
|
if (data.bolt.actionTimer.get() > 0) {
|
||||||
data.bolt.reduceActionTime();
|
data.bolt.actionTimer.reduce();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getItem() == ModItems.MARLIN.get() && data.bolt.actionTime() == 9) {
|
if (stack.getItem() == ModItems.MARLIN.get() && data.bolt.actionTimer.get() == 9) {
|
||||||
data.setIsEmpty(false);
|
data.isEmpty.set(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.bolt.actionTime() == 1) {
|
if (data.bolt.actionTimer.get() == 1) {
|
||||||
data.bolt.markNeedless();
|
data.bolt.needed.set(false);
|
||||||
if (stack.is(ModTags.Items.REVOLVER)) {
|
if (stack.is(ModTags.Items.REVOLVER)) {
|
||||||
data.setCanImmediatelyShoot(true);
|
data.canImmediatelyShoot.set(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -156,7 +156,7 @@ public class GunEventHandler {
|
||||||
|
|
||||||
if (stack.is(ModTags.Items.REVOLVER)) return;
|
if (stack.is(ModTags.Items.REVOLVER)) return;
|
||||||
|
|
||||||
Mod.queueServerWork((int) (data.bolt.defaultActionTime() / 2 + 1.5 * shooterHeight), () -> {
|
Mod.queueServerWork((int) (data.defaultActionTime() / 2 + 1.5 * shooterHeight), () -> {
|
||||||
if (stack.is(ModTags.Items.SHOTGUN)) {
|
if (stack.is(ModTags.Items.SHOTGUN)) {
|
||||||
SoundTool.playLocalSound(serverPlayer, ModSounds.SHELL_CASING_SHOTGUN.get(), (float) Math.max(0.75 - 0.12 * shooterHeight, 0), 1);
|
SoundTool.playLocalSound(serverPlayer, ModSounds.SHELL_CASING_SHOTGUN.get(), (float) Math.max(0.75 - 0.12 * shooterHeight, 0), 1);
|
||||||
} else if (stack.is(ModTags.Items.SNIPER_RIFLE)) {
|
} else if (stack.is(ModTags.Items.SNIPER_RIFLE)) {
|
||||||
|
@ -270,7 +270,7 @@ public class GunEventHandler {
|
||||||
NeoForge.EVENT_BUS.post(new ReloadEvent.Pre(player, stack));
|
NeoForge.EVENT_BUS.post(new ReloadEvent.Pre(player, stack));
|
||||||
|
|
||||||
if (gunItem.isOpenBolt(stack)) {
|
if (gunItem.isOpenBolt(stack)) {
|
||||||
if (gun.ammo() == 0) {
|
if (gun.ammo.get() == 0) {
|
||||||
reload.setTime(gun.defaultEmptyReloadTime() + 1);
|
reload.setTime(gun.defaultEmptyReloadTime() + 1);
|
||||||
reload.setState(ReloadState.EMPTY_RELOADING);
|
reload.setState(ReloadState.EMPTY_RELOADING);
|
||||||
playGunEmptyReloadSounds(player);
|
playGunEmptyReloadSounds(player);
|
||||||
|
@ -295,7 +295,7 @@ public class GunEventHandler {
|
||||||
|
|
||||||
if (reload.time() == 1) {
|
if (reload.time() == 1) {
|
||||||
if (gunItem.isOpenBolt(stack)) {
|
if (gunItem.isOpenBolt(stack)) {
|
||||||
if (gun.ammo() == 0) {
|
if (gun.ammo.get() == 0) {
|
||||||
playGunEmptyReload(player, gun);
|
playGunEmptyReload(player, gun);
|
||||||
} else {
|
} else {
|
||||||
playGunNormalReload(player, gun);
|
playGunNormalReload(player, gun);
|
||||||
|
@ -312,7 +312,7 @@ public class GunEventHandler {
|
||||||
var gunItem = gunData.item();
|
var gunItem = gunData.item();
|
||||||
|
|
||||||
if (player.getInventory().hasAnyMatching(item -> item.is(ModItems.CREATIVE_AMMO_BOX.get()))) {
|
if (player.getInventory().hasAnyMatching(item -> item.is(ModItems.CREATIVE_AMMO_BOX.get()))) {
|
||||||
gunData.setAmmo(gunData.magazine() + (gunItem.hasBulletInBarrel(stack) ? 1 : 0));
|
gunData.ammo.set(gunData.magazine() + (gunItem.hasBulletInBarrel(stack) ? 1 : 0));
|
||||||
} else {
|
} else {
|
||||||
if (stack.is(ModTags.Items.USE_SHOTGUN_AMMO)) {
|
if (stack.is(ModTags.Items.USE_SHOTGUN_AMMO)) {
|
||||||
GunsTool.reload(player, stack, gunData, AmmoType.SHOTGUN, gunItem.hasBulletInBarrel(stack));
|
GunsTool.reload(player, stack, gunData, AmmoType.SHOTGUN, gunItem.hasBulletInBarrel(stack));
|
||||||
|
@ -334,7 +334,7 @@ public class GunEventHandler {
|
||||||
ItemStack stack = data.stack();
|
ItemStack stack = data.stack();
|
||||||
|
|
||||||
if (player.getInventory().hasAnyMatching(item -> item.is(ModItems.CREATIVE_AMMO_BOX.get()))) {
|
if (player.getInventory().hasAnyMatching(item -> item.is(ModItems.CREATIVE_AMMO_BOX.get()))) {
|
||||||
data.setAmmo(data.magazine());
|
data.ammo.set(data.magazine());
|
||||||
} else {
|
} else {
|
||||||
if (stack.is(ModTags.Items.USE_SHOTGUN_AMMO)) {
|
if (stack.is(ModTags.Items.USE_SHOTGUN_AMMO)) {
|
||||||
GunsTool.reload(player, stack, data, AmmoType.SHOTGUN);
|
GunsTool.reload(player, stack, data, AmmoType.SHOTGUN);
|
||||||
|
@ -348,7 +348,7 @@ public class GunEventHandler {
|
||||||
GunsTool.reload(player, stack, data, AmmoType.HEAVY);
|
GunsTool.reload(player, stack, data, AmmoType.HEAVY);
|
||||||
} else if (data.item().getCustomAmmoItem() != null) {
|
} else if (data.item().getCustomAmmoItem() != null) {
|
||||||
var ammoItem = data.item().getCustomAmmoItem();
|
var ammoItem = data.item().getCustomAmmoItem();
|
||||||
data.setAmmo(1);
|
data.ammo.set(1);
|
||||||
player.getInventory().clearOrCountMatchingItems(p -> p.getItem() == ammoItem, 1, player.inventoryMenu.getCraftSlots());
|
player.getInventory().clearOrCountMatchingItems(p -> p.getItem() == ammoItem, 1, player.inventoryMenu.getCraftSlots());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -414,13 +414,13 @@ public class GunEventHandler {
|
||||||
if (reload.singleReloadStarter.start()) {
|
if (reload.singleReloadStarter.start()) {
|
||||||
NeoForge.EVENT_BUS.post(new ReloadEvent.Pre(player, stack));
|
NeoForge.EVENT_BUS.post(new ReloadEvent.Pre(player, stack));
|
||||||
|
|
||||||
if ((data.defaultPrepareLoadTime() != 0 && data.ammo() == 0) || stack.is(ModItems.SECONDARY_CATACLYSM.get())) {
|
if ((data.defaultPrepareLoadTime() != 0 && data.ammo.get() == 0) || stack.is(ModItems.SECONDARY_CATACLYSM.get())) {
|
||||||
// 此处判断空仓换弹的时候,是否在准备阶段就需要装填一发,如M870
|
// 此处判断空仓换弹的时候,是否在准备阶段就需要装填一发,如M870
|
||||||
playGunPrepareLoadReloadSounds(player);
|
playGunPrepareLoadReloadSounds(player);
|
||||||
int prepareLoadTime = data.defaultPrepareLoadTime();
|
int prepareLoadTime = data.defaultPrepareLoadTime();
|
||||||
reload.prepareLoadTimer.set(prepareLoadTime + 1);
|
reload.prepareLoadTimer.set(prepareLoadTime + 1);
|
||||||
player.getCooldowns().addCooldown(stack.getItem(), prepareLoadTime);
|
player.getCooldowns().addCooldown(stack.getItem(), prepareLoadTime);
|
||||||
} else if (data.defaultPrepareEmptyTime() != 0 && data.ammo() == 0) {
|
} else if (data.defaultPrepareEmptyTime() != 0 && data.ammo.get() == 0) {
|
||||||
// 此处判断空仓换弹,如莫辛纳甘
|
// 此处判断空仓换弹,如莫辛纳甘
|
||||||
playGunEmptyPrepareSounds(player);
|
playGunEmptyPrepareSounds(player);
|
||||||
int prepareEmptyTime = data.defaultPrepareEmptyTime();
|
int prepareEmptyTime = data.defaultPrepareEmptyTime();
|
||||||
|
@ -433,8 +433,8 @@ public class GunEventHandler {
|
||||||
player.getCooldowns().addCooldown(stack.getItem(), prepareTime);
|
player.getCooldowns().addCooldown(stack.getItem(), prepareTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
data.setForceStop(false);
|
data.forceStop.set(false);
|
||||||
data.setStopped(false);
|
data.stopped.set(false);
|
||||||
reload.setStage(1);
|
reload.setStage(1);
|
||||||
reload.setState(ReloadState.NORMAL_RELOADING);
|
reload.setState(ReloadState.NORMAL_RELOADING);
|
||||||
}
|
}
|
||||||
|
@ -457,15 +457,15 @@ public class GunEventHandler {
|
||||||
|| stack.is(ModTags.Items.USE_HANDGUN_AMMO) && capability.handgunAmmo == 0
|
|| stack.is(ModTags.Items.USE_HANDGUN_AMMO) && capability.handgunAmmo == 0
|
||||||
|| stack.is(ModTags.Items.USE_RIFLE_AMMO) && capability.rifleAmmo == 0
|
|| stack.is(ModTags.Items.USE_RIFLE_AMMO) && capability.rifleAmmo == 0
|
||||||
|| stack.is(ModTags.Items.USE_HEAVY_AMMO) && capability.heavyAmmo == 0
|
|| stack.is(ModTags.Items.USE_HEAVY_AMMO) && capability.heavyAmmo == 0
|
||||||
|| stack.is(ModTags.Items.LAUNCHER) && data.maxAmmo() == 0
|
|| stack.is(ModTags.Items.LAUNCHER) && data.maxAmmo.get() == 0
|
||||||
|| stack.is(ModItems.SECONDARY_CATACLYSM.get()) && data.ammo() >= data.magazine()
|
|| stack.is(ModItems.SECONDARY_CATACLYSM.get()) && data.ammo.get() >= data.magazine()
|
||||||
) {
|
) {
|
||||||
reload.stage3Starter.markStart();
|
reload.stage3Starter.markStart();
|
||||||
} else {
|
} else {
|
||||||
reload.setStage(2);
|
reload.setStage(2);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (stack.is(ModItems.SECONDARY_CATACLYSM.get()) && data.ammo() >= data.magazine()) {
|
if (stack.is(ModItems.SECONDARY_CATACLYSM.get()) && data.ammo.get() >= data.magazine()) {
|
||||||
reload.stage3Starter.markStart();
|
reload.stage3Starter.markStart();
|
||||||
} else {
|
} else {
|
||||||
reload.setStage(2);
|
reload.setStage(2);
|
||||||
|
@ -475,23 +475,23 @@ public class GunEventHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 强制停止换弹,进入三阶段
|
// 强制停止换弹,进入三阶段
|
||||||
if (data.forceStop() && reload.stage() == 2 && reload.iterativeLoadTimer.get() > 0) {
|
if (data.forceStop.get() && reload.stage() == 2 && reload.iterativeLoadTimer.get() > 0) {
|
||||||
data.setForceStop(true);
|
data.forceStop.set(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 二阶段
|
// 二阶段
|
||||||
if ((reload.prepareTimer.get() == 0 || reload.iterativeLoadTimer.get() == 0)
|
if ((reload.prepareTimer.get() == 0 || reload.iterativeLoadTimer.get() == 0)
|
||||||
&& reload.stage() == 2
|
&& reload.stage() == 2
|
||||||
&& reload.iterativeLoadTimer.get() == 0
|
&& reload.iterativeLoadTimer.get() == 0
|
||||||
&& !data.stopped()
|
&& !data.stopped.get()
|
||||||
&& data.ammo() < data.magazine()
|
&& data.ammo.get() < data.magazine()
|
||||||
) {
|
) {
|
||||||
playGunLoopReloadSounds(player);
|
playGunLoopReloadSounds(player);
|
||||||
int iterativeTime = data.defaultIterativeTime();
|
int iterativeTime = data.defaultIterativeTime();
|
||||||
reload.iterativeLoadTimer.set(iterativeTime);
|
reload.iterativeLoadTimer.set(iterativeTime);
|
||||||
player.getCooldowns().addCooldown(stack.getItem(), iterativeTime);
|
player.getCooldowns().addCooldown(stack.getItem(), iterativeTime);
|
||||||
// 动画播放nbt
|
// 动画播放nbt
|
||||||
data.setLoadIndex(data.loadIndex() == 1 ? 0 : 1);
|
data.loadIndex.set(data.loadIndex.get() == 1 ? 0 : 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 装填
|
// 装填
|
||||||
|
@ -515,7 +515,7 @@ public class GunEventHandler {
|
||||||
// 二阶段结束
|
// 二阶段结束
|
||||||
if (reload.iterativeLoadTimer.get() == 1) {
|
if (reload.iterativeLoadTimer.get() == 1) {
|
||||||
// 装满结束
|
// 装满结束
|
||||||
if (data.ammo() >= data.magazine()) {
|
if (data.ammo.get() >= data.magazine()) {
|
||||||
reload.setStage(3);
|
reload.setStage(3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -537,10 +537,10 @@ public class GunEventHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 强制结束
|
// 强制结束
|
||||||
if (data.stopped()) {
|
if (data.stopped.get()) {
|
||||||
reload.setStage(3);
|
reload.setStage(3);
|
||||||
data.setStopped(false);
|
data.stopped.set(false);
|
||||||
data.setForceStop(false);
|
data.forceStop.set(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -557,14 +557,14 @@ public class GunEventHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getItem() == ModItems.MARLIN.get() && reload.finishTimer.get() == 10) {
|
if (stack.getItem() == ModItems.MARLIN.get() && reload.finishTimer.get() == 10) {
|
||||||
data.setIsEmpty(false);
|
data.isEmpty.set(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 三阶段结束
|
// 三阶段结束
|
||||||
if (reload.finishTimer.get() == 1) {
|
if (reload.finishTimer.get() == 1) {
|
||||||
reload.setStage(0);
|
reload.setStage(0);
|
||||||
if (data.bolt.defaultActionTime() > 0) {
|
if (data.defaultActionTime() > 0) {
|
||||||
data.bolt.markNeedless();
|
data.bolt.needed.set(false);
|
||||||
}
|
}
|
||||||
reload.setState(ReloadState.NOT_RELOADING);
|
reload.setState(ReloadState.NOT_RELOADING);
|
||||||
reload.singleReloadStarter.finish();
|
reload.singleReloadStarter.finish();
|
||||||
|
@ -574,7 +574,7 @@ public class GunEventHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void singleLoad(Player player, GunData data) {
|
public static void singleLoad(Player player, GunData data) {
|
||||||
data.setAmmo(data.ammo() + 1);
|
data.ammo.set(data.ammo.get() + 1);
|
||||||
|
|
||||||
if (!InventoryTool.hasCreativeAmmoBox(player)) {
|
if (!InventoryTool.hasCreativeAmmoBox(player)) {
|
||||||
var cap = player.getData(ModAttachments.PLAYER_VARIABLE);
|
var cap = player.getData(ModAttachments.PLAYER_VARIABLE);
|
||||||
|
|
|
@ -16,7 +16,7 @@ import com.atsuishio.superbwarfare.init.*;
|
||||||
import com.atsuishio.superbwarfare.item.common.ammo.box.AmmoBoxInfo;
|
import com.atsuishio.superbwarfare.item.common.ammo.box.AmmoBoxInfo;
|
||||||
import com.atsuishio.superbwarfare.item.gun.GunItem;
|
import com.atsuishio.superbwarfare.item.gun.GunItem;
|
||||||
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
||||||
import com.atsuishio.superbwarfare.item.gun.data.ReloadState;
|
import com.atsuishio.superbwarfare.item.gun.data.value.ReloadState;
|
||||||
import com.atsuishio.superbwarfare.network.message.receive.ClientIndicatorMessage;
|
import com.atsuishio.superbwarfare.network.message.receive.ClientIndicatorMessage;
|
||||||
import com.atsuishio.superbwarfare.network.message.receive.DrawClientMessage;
|
import com.atsuishio.superbwarfare.network.message.receive.DrawClientMessage;
|
||||||
import com.atsuishio.superbwarfare.network.message.receive.PlayerGunKillMessage;
|
import com.atsuishio.superbwarfare.network.message.receive.PlayerGunKillMessage;
|
||||||
|
@ -218,14 +218,14 @@ public class LivingEventHandler {
|
||||||
// 先处理发射器类武器或高爆弹的爆炸伤害
|
// 先处理发射器类武器或高爆弹的爆炸伤害
|
||||||
if (source.is(ModDamageTypes.PROJECTILE_BOOM)) {
|
if (source.is(ModDamageTypes.PROJECTILE_BOOM)) {
|
||||||
if (stack.is(ModTags.Items.LAUNCHER) || data.perk.getLevel(ModPerks.HE_BULLET) > 0) {
|
if (stack.is(ModTags.Items.LAUNCHER) || data.perk.getLevel(ModPerks.HE_BULLET) > 0) {
|
||||||
data.setExp(data.exp() + amount);
|
data.exp.set(data.exp.get() + amount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 再判断是不是枪械能造成的伤害
|
// 再判断是不是枪械能造成的伤害
|
||||||
if (!DamageTypeTool.isGunDamage(source)) return;
|
if (!DamageTypeTool.isGunDamage(source)) return;
|
||||||
|
|
||||||
data.setExp(data.exp() + amount);
|
data.exp.set(data.exp.get() + amount);
|
||||||
data.save();
|
data.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -243,27 +243,27 @@ public class LivingEventHandler {
|
||||||
// 先处理发射器类武器或高爆弹的爆炸伤害
|
// 先处理发射器类武器或高爆弹的爆炸伤害
|
||||||
if (source.is(ModDamageTypes.PROJECTILE_BOOM)) {
|
if (source.is(ModDamageTypes.PROJECTILE_BOOM)) {
|
||||||
if (stack.is(ModTags.Items.LAUNCHER) || data.perk.getLevel(ModPerks.HE_BULLET) > 0) {
|
if (stack.is(ModTags.Items.LAUNCHER) || data.perk.getLevel(ModPerks.HE_BULLET) > 0) {
|
||||||
data.setExp(data.exp() + amount);
|
data.exp.set(data.exp.get() + amount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 再判断是不是枪械能造成的伤害
|
// 再判断是不是枪械能造成的伤害
|
||||||
if (DamageTypeTool.isGunDamage(source)) {
|
if (DamageTypeTool.isGunDamage(source)) {
|
||||||
data.setExp(data.exp() + amount);
|
data.exp.set(data.exp.get() + amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 提升武器等级
|
// 提升武器等级
|
||||||
int level = data.level();
|
int level = data.level.get();
|
||||||
double exp = data.exp();
|
double exp = data.exp.get();
|
||||||
double upgradeExpNeeded = 20 * Math.pow(level, 2) + 160 * level + 20;
|
double upgradeExpNeeded = 20 * Math.pow(level, 2) + 160 * level + 20;
|
||||||
|
|
||||||
while (exp >= upgradeExpNeeded) {
|
while (exp >= upgradeExpNeeded) {
|
||||||
exp -= upgradeExpNeeded;
|
exp -= upgradeExpNeeded;
|
||||||
level = data.level() + 1;
|
level = data.level.get() + 1;
|
||||||
upgradeExpNeeded = 20 * Math.pow(level, 2) + 160 * level + 20;
|
upgradeExpNeeded = 20 * Math.pow(level, 2) + 160 * level + 20;
|
||||||
data.setExp(exp);
|
data.exp.set(exp);
|
||||||
data.setLevel(level);
|
data.level.set(level);
|
||||||
data.setUpgradePoint(data.upgradePoint() + 0.5);
|
data.upgradePoint.set(data.upgradePoint.get() + 0.5);
|
||||||
}
|
}
|
||||||
data.save();
|
data.save();
|
||||||
}
|
}
|
||||||
|
@ -277,17 +277,17 @@ public class LivingEventHandler {
|
||||||
if (event.getEntity() instanceof TargetEntity) return;
|
if (event.getEntity() instanceof TargetEntity) return;
|
||||||
|
|
||||||
var data = GunData.from(stack);
|
var data = GunData.from(stack);
|
||||||
int level = data.level();
|
int level = data.level.get();
|
||||||
double exp = data.exp();
|
double exp = data.exp.get();
|
||||||
double upgradeExpNeeded = 20 * Math.pow(level, 2) + 160 * level + 20;
|
double upgradeExpNeeded = 20 * Math.pow(level, 2) + 160 * level + 20;
|
||||||
|
|
||||||
while (exp >= upgradeExpNeeded) {
|
while (exp >= upgradeExpNeeded) {
|
||||||
exp -= upgradeExpNeeded;
|
exp -= upgradeExpNeeded;
|
||||||
level = data.level() + 1;
|
level = data.level.get() + 1;
|
||||||
upgradeExpNeeded = 20 * Math.pow(level, 2) + 160 * level + 20;
|
upgradeExpNeeded = 20 * Math.pow(level, 2) + 160 * level + 20;
|
||||||
data.setExp(exp);
|
data.exp.set(exp);
|
||||||
data.setLevel(level);
|
data.level.set(level);
|
||||||
data.setUpgradePoint(data.upgradePoint() + 0.5);
|
data.upgradePoint.set(data.upgradePoint.get() + 0.5);
|
||||||
}
|
}
|
||||||
data.save();
|
data.save();
|
||||||
}
|
}
|
||||||
|
@ -357,8 +357,8 @@ public class LivingEventHandler {
|
||||||
|
|
||||||
var oldData = GunData.from(oldStack);
|
var oldData = GunData.from(oldStack);
|
||||||
|
|
||||||
if (oldData.bolt.defaultActionTime() > 0) {
|
if (oldData.defaultActionTime() > 0) {
|
||||||
oldData.bolt.setActionTime(0);
|
oldData.bolt.actionTimer.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
oldData.reload.setTime(0);
|
oldData.reload.setTime(0);
|
||||||
|
@ -366,8 +366,8 @@ public class LivingEventHandler {
|
||||||
oldData.reload.setState(ReloadState.NOT_RELOADING);
|
oldData.reload.setState(ReloadState.NOT_RELOADING);
|
||||||
|
|
||||||
if (oldData.defaultIterativeTime() != 0) {
|
if (oldData.defaultIterativeTime() != 0) {
|
||||||
oldData.setStopped(false);
|
oldData.stopped.set(false);
|
||||||
oldData.setForceStop(false);
|
oldData.forceStop.set(false);
|
||||||
oldData.reload.setStage(0);
|
oldData.reload.setStage(0);
|
||||||
oldData.reload.prepareTimer.reset();
|
oldData.reload.prepareTimer.reset();
|
||||||
oldData.reload.prepareLoadTimer.reset();
|
oldData.reload.prepareLoadTimer.reset();
|
||||||
|
@ -393,16 +393,16 @@ public class LivingEventHandler {
|
||||||
newTag = newData.tag();
|
newTag = newData.tag();
|
||||||
|
|
||||||
newTag.putBoolean("draw", true);
|
newTag.putBoolean("draw", true);
|
||||||
if (newData.bolt.defaultActionTime() > 0) {
|
if (newData.defaultActionTime() > 0) {
|
||||||
newData.bolt.setActionTime(0);
|
newData.bolt.actionTimer.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
newData.reload.setState(ReloadState.NOT_RELOADING);
|
newData.reload.setState(ReloadState.NOT_RELOADING);
|
||||||
newData.reload.reloadTimer.reset();
|
newData.reload.reloadTimer.reset();
|
||||||
|
|
||||||
if (newData.defaultIterativeTime() != 0) {
|
if (newData.defaultIterativeTime() != 0) {
|
||||||
newData.setForceStop(false);
|
newData.forceStop.set(false);
|
||||||
newData.setStopped(false);
|
newData.stopped.set(false);
|
||||||
newData.reload.setStage(0);
|
newData.reload.setStage(0);
|
||||||
newData.reload.prepareTimer.reset();
|
newData.reload.prepareTimer.reset();
|
||||||
newData.reload.prepareLoadTimer.reset();
|
newData.reload.prepareLoadTimer.reset();
|
||||||
|
@ -643,7 +643,7 @@ public class LivingEventHandler {
|
||||||
var cap = player.getData(ModAttachments.PLAYER_VARIABLE).watch();
|
var cap = player.getData(ModAttachments.PLAYER_VARIABLE).watch();
|
||||||
|
|
||||||
int mag = data.magazine();
|
int mag = data.magazine();
|
||||||
int ammo = data.ammo();
|
int ammo = data.ammo.get();
|
||||||
int ammoReload = (int) Math.min(mag, mag * rate);
|
int ammoReload = (int) Math.min(mag, mag * rate);
|
||||||
int ammoNeed = Math.min(mag - ammo, ammoReload);
|
int ammoNeed = Math.min(mag - ammo, ammoReload);
|
||||||
|
|
||||||
|
@ -656,7 +656,7 @@ public class LivingEventHandler {
|
||||||
} else {
|
} else {
|
||||||
cap.rifleAmmo -= ammoFinal;
|
cap.rifleAmmo -= ammoFinal;
|
||||||
}
|
}
|
||||||
data.setAmmo(Math.min(mag, ammo + ammoFinal));
|
data.ammo.set(Math.min(mag, ammo + ammoFinal));
|
||||||
} else if (stack.is(ModTags.Items.USE_HANDGUN_AMMO)) {
|
} else if (stack.is(ModTags.Items.USE_HANDGUN_AMMO)) {
|
||||||
int ammoFinal = Math.min(cap.handgunAmmo, ammoNeed);
|
int ammoFinal = Math.min(cap.handgunAmmo, ammoNeed);
|
||||||
if (flag) {
|
if (flag) {
|
||||||
|
@ -664,7 +664,7 @@ public class LivingEventHandler {
|
||||||
} else {
|
} else {
|
||||||
cap.handgunAmmo -= ammoFinal;
|
cap.handgunAmmo -= ammoFinal;
|
||||||
}
|
}
|
||||||
data.setAmmo(Math.min(mag, ammo + ammoFinal));
|
data.ammo.set(Math.min(mag, ammo + ammoFinal));
|
||||||
}
|
}
|
||||||
data.save();
|
data.save();
|
||||||
player.setData(ModAttachments.PLAYER_VARIABLE, cap);
|
player.setData(ModAttachments.PLAYER_VARIABLE, cap);
|
||||||
|
|
|
@ -84,8 +84,8 @@ public class PlayerEventHandler {
|
||||||
|
|
||||||
var data = GunData.from(stack);
|
var data = GunData.from(stack);
|
||||||
|
|
||||||
if ((stack.is(ModItems.RPG.get()) || stack.is(ModItems.BOCEK.get())) && data.ammo() == 1) {
|
if ((stack.is(ModItems.RPG.get()) || stack.is(ModItems.BOCEK.get())) && data.ammo.get() == 1) {
|
||||||
data.setIsEmpty(false);
|
data.isEmpty.set(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,24 +123,24 @@ public class PlayerEventHandler {
|
||||||
GunsTool.reload(player, stack, data, AmmoType.HEAVY);
|
GunsTool.reload(player, stack, data, AmmoType.HEAVY);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getItem() == ModItems.TASER.get() && data.maxAmmo() > 0 && data.ammo() == 0) {
|
if (stack.getItem() == ModItems.TASER.get() && data.maxAmmo.get() > 0 && data.ammo.get() == 0) {
|
||||||
data.setAmmo(1);
|
data.ammo.set(1);
|
||||||
player.getInventory().clearOrCountMatchingItems(p -> p.getItem() == ModItems.TASER_ELECTRODE.get(), 1, player.inventoryMenu.getCraftSlots());
|
player.getInventory().clearOrCountMatchingItems(p -> p.getItem() == ModItems.TASER_ELECTRODE.get(), 1, player.inventoryMenu.getCraftSlots());
|
||||||
}
|
}
|
||||||
if (stack.getItem() == ModItems.M_79.get() && data.maxAmmo() > 0 && data.ammo() == 0) {
|
if (stack.getItem() == ModItems.M_79.get() && data.maxAmmo.get() > 0 && data.ammo.get() == 0) {
|
||||||
data.setAmmo(1);
|
data.ammo.set(1);
|
||||||
player.getInventory().clearOrCountMatchingItems(p -> p.getItem() == ModItems.GRENADE_40MM.get(), 1, player.inventoryMenu.getCraftSlots());
|
player.getInventory().clearOrCountMatchingItems(p -> p.getItem() == ModItems.GRENADE_40MM.get(), 1, player.inventoryMenu.getCraftSlots());
|
||||||
}
|
}
|
||||||
if (stack.getItem() == ModItems.RPG.get() && data.maxAmmo() > 0 && data.ammo() == 0) {
|
if (stack.getItem() == ModItems.RPG.get() && data.maxAmmo.get() > 0 && data.ammo.get() == 0) {
|
||||||
data.setAmmo(1);
|
data.ammo.set(1);
|
||||||
player.getInventory().clearOrCountMatchingItems(p -> p.getItem() == ModItems.ROCKET.get(), 1, player.inventoryMenu.getCraftSlots());
|
player.getInventory().clearOrCountMatchingItems(p -> p.getItem() == ModItems.ROCKET.get(), 1, player.inventoryMenu.getCraftSlots());
|
||||||
}
|
}
|
||||||
if (stack.getItem() == ModItems.JAVELIN.get() && data.maxAmmo() > 0 && data.ammo() == 0) {
|
if (stack.getItem() == ModItems.JAVELIN.get() && data.maxAmmo.get() > 0 && data.ammo.get() == 0) {
|
||||||
data.setAmmo(1);
|
data.ammo.set(1);
|
||||||
player.getInventory().clearOrCountMatchingItems(p -> p.getItem() == ModItems.JAVELIN_MISSILE.get(), 1, player.inventoryMenu.getCraftSlots());
|
player.getInventory().clearOrCountMatchingItems(p -> p.getItem() == ModItems.JAVELIN_MISSILE.get(), 1, player.inventoryMenu.getCraftSlots());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
data.setAmmo(data.magazine());
|
data.ammo.set(data.magazine());
|
||||||
}
|
}
|
||||||
GunsTool.setGunBooleanTag(tag, "HoldOpen", false);
|
GunsTool.setGunBooleanTag(tag, "HoldOpen", false);
|
||||||
data.save();
|
data.save();
|
||||||
|
@ -192,7 +192,7 @@ public class PlayerEventHandler {
|
||||||
ItemStack output = left.copy();
|
ItemStack output = left.copy();
|
||||||
|
|
||||||
var data = GunData.from(output);
|
var data = GunData.from(output);
|
||||||
data.setUpgradePoint(data.upgradePoint() + 1);
|
data.upgradePoint.set(data.upgradePoint.get() + 1);
|
||||||
data.save();
|
data.save();
|
||||||
|
|
||||||
event.setOutput(output);
|
event.setOutput(output);
|
||||||
|
|
|
@ -8,8 +8,8 @@ import com.atsuishio.superbwarfare.init.ModItems;
|
||||||
import com.atsuishio.superbwarfare.init.ModPerks;
|
import com.atsuishio.superbwarfare.init.ModPerks;
|
||||||
import com.atsuishio.superbwarfare.init.ModTags;
|
import com.atsuishio.superbwarfare.init.ModTags;
|
||||||
import com.atsuishio.superbwarfare.item.CustomRendererItem;
|
import com.atsuishio.superbwarfare.item.CustomRendererItem;
|
||||||
import com.atsuishio.superbwarfare.item.gun.data.AttachmentType;
|
|
||||||
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
||||||
|
import com.atsuishio.superbwarfare.item.gun.data.value.AttachmentType;
|
||||||
import com.atsuishio.superbwarfare.perk.Perk;
|
import com.atsuishio.superbwarfare.perk.Perk;
|
||||||
import com.atsuishio.superbwarfare.tools.AmmoType;
|
import com.atsuishio.superbwarfare.tools.AmmoType;
|
||||||
import net.minecraft.client.model.HumanoidModel;
|
import net.minecraft.client.model.HumanoidModel;
|
||||||
|
@ -70,14 +70,14 @@ public abstract class GunItem extends Item implements CustomRendererItem {
|
||||||
if (!data.initialized()) {
|
if (!data.initialized()) {
|
||||||
data.initialize();
|
data.initialize();
|
||||||
if (level.getServer() != null && entity instanceof Player player && player.isCreative()) {
|
if (level.getServer() != null && entity instanceof Player player && player.isCreative()) {
|
||||||
data.setAmmo(data.magazine());
|
data.ammo.set(data.magazine());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tag.putBoolean("draw", false);
|
tag.putBoolean("draw", false);
|
||||||
handleGunPerks(data);
|
handleGunPerks(data);
|
||||||
|
|
||||||
var hasBulletInBarrel = gunItem.hasBulletInBarrel(stack);
|
var hasBulletInBarrel = gunItem.hasBulletInBarrel(stack);
|
||||||
var ammoCount = data.ammo();
|
var ammoCount = data.ammo.get();
|
||||||
var magazine = data.magazine();
|
var magazine = data.magazine();
|
||||||
|
|
||||||
if ((hasBulletInBarrel && ammoCount > magazine + 1) || (!hasBulletInBarrel && ammoCount > magazine)) {
|
if ((hasBulletInBarrel && ammoCount > magazine + 1) || (!hasBulletInBarrel && ammoCount > magazine)) {
|
||||||
|
@ -97,7 +97,7 @@ public abstract class GunItem extends Item implements CustomRendererItem {
|
||||||
}
|
}
|
||||||
entity.setData(ModAttachments.PLAYER_VARIABLE, capability);
|
entity.setData(ModAttachments.PLAYER_VARIABLE, capability);
|
||||||
capability.sync(entity);
|
capability.sync(entity);
|
||||||
data.setAmmo(magazine + (hasBulletInBarrel ? 1 : 0));
|
data.ammo.set(magazine + (hasBulletInBarrel ? 1 : 0));
|
||||||
}
|
}
|
||||||
data.save();
|
data.save();
|
||||||
}
|
}
|
||||||
|
@ -185,7 +185,7 @@ public abstract class GunItem extends Item implements CustomRendererItem {
|
||||||
tag.remove("FourthTimesCharmCount");
|
tag.remove("FourthTimesCharmCount");
|
||||||
|
|
||||||
int mag = data.magazine();
|
int mag = data.magazine();
|
||||||
data.setAmmo(Math.min(mag, data.ammo() + 2));
|
data.ammo.set(Math.min(mag, data.ammo.get() + 2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,47 +0,0 @@
|
||||||
package com.atsuishio.superbwarfare.item.gun.data;
|
|
||||||
|
|
||||||
import net.minecraft.nbt.CompoundTag;
|
|
||||||
|
|
||||||
public final class Bolt {
|
|
||||||
private final CompoundTag data;
|
|
||||||
private final GunData gunData;
|
|
||||||
|
|
||||||
|
|
||||||
Bolt(GunData data) {
|
|
||||||
this.gunData = data;
|
|
||||||
this.data = data.data();
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean needed() {
|
|
||||||
return data.getBoolean("NeedBoltAction");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void markNeeded() {
|
|
||||||
data.putBoolean("NeedBoltAction", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void markNeedless() {
|
|
||||||
data.remove("NeedBoltAction");
|
|
||||||
}
|
|
||||||
|
|
||||||
public int defaultActionTime() {
|
|
||||||
return (int) gunData.getGunData("BoltActionTime") + gunData.item().getCustomBoltActionTime(gunData.stack());
|
|
||||||
}
|
|
||||||
|
|
||||||
public int actionTime() {
|
|
||||||
return data.getInt("BoltActionTime");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setActionTime(int tick) {
|
|
||||||
if (tick <= 0) {
|
|
||||||
data.remove("BoltActionTime");
|
|
||||||
} else {
|
|
||||||
data.putInt("BoltActionTime", tick);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void reduceActionTime() {
|
|
||||||
setActionTime(actionTime() - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,15 +0,0 @@
|
||||||
package com.atsuishio.superbwarfare.item.gun.data;
|
|
||||||
|
|
||||||
public final class Charge {
|
|
||||||
public final Timer timer;
|
|
||||||
public final Starter starter;
|
|
||||||
|
|
||||||
Charge(GunData data) {
|
|
||||||
this.timer = new Timer(data.data(), "Charge");
|
|
||||||
this.starter = new Starter(data.data(), "Charge");
|
|
||||||
}
|
|
||||||
|
|
||||||
public int time() {
|
|
||||||
return timer.get();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,6 +1,8 @@
|
||||||
package com.atsuishio.superbwarfare.item.gun.data;
|
package com.atsuishio.superbwarfare.item.gun.data;
|
||||||
|
|
||||||
import com.atsuishio.superbwarfare.item.gun.GunItem;
|
import com.atsuishio.superbwarfare.item.gun.GunItem;
|
||||||
|
import com.atsuishio.superbwarfare.item.gun.data.subdata.*;
|
||||||
|
import com.atsuishio.superbwarfare.item.gun.data.value.*;
|
||||||
import com.atsuishio.superbwarfare.perk.AmmoPerk;
|
import com.atsuishio.superbwarfare.perk.AmmoPerk;
|
||||||
import com.atsuishio.superbwarfare.perk.Perk;
|
import com.atsuishio.superbwarfare.perk.Perk;
|
||||||
import com.atsuishio.superbwarfare.tools.GunsTool;
|
import com.atsuishio.superbwarfare.tools.GunsTool;
|
||||||
|
@ -15,13 +17,13 @@ import java.util.UUID;
|
||||||
import java.util.WeakHashMap;
|
import java.util.WeakHashMap;
|
||||||
|
|
||||||
public class GunData {
|
public class GunData {
|
||||||
private final ItemStack stack;
|
public final ItemStack stack;
|
||||||
private final GunItem item;
|
public final GunItem item;
|
||||||
private final CompoundTag tag;
|
public final CompoundTag tag;
|
||||||
private final CompoundTag data;
|
public final CompoundTag data;
|
||||||
private final CompoundTag perkTag;
|
public final CompoundTag perkTag;
|
||||||
private final CompoundTag attachmentTag;
|
public final CompoundTag attachmentTag;
|
||||||
private final String id;
|
public final String id;
|
||||||
|
|
||||||
private static final WeakHashMap<ItemStack, GunData> dataCache = new WeakHashMap<>();
|
private static final WeakHashMap<ItemStack, GunData> dataCache = new WeakHashMap<>();
|
||||||
|
|
||||||
|
@ -29,6 +31,7 @@ public class GunData {
|
||||||
if (!(stack.getItem() instanceof GunItem gunItem)) {
|
if (!(stack.getItem() instanceof GunItem gunItem)) {
|
||||||
throw new IllegalArgumentException("stack is not GunItem!");
|
throw new IllegalArgumentException("stack is not GunItem!");
|
||||||
}
|
}
|
||||||
|
|
||||||
this.item = gunItem;
|
this.item = gunItem;
|
||||||
this.stack = stack;
|
this.stack = stack;
|
||||||
var id = stack.getDescriptionId();
|
var id = stack.getDescriptionId();
|
||||||
|
@ -46,6 +49,21 @@ public class GunData {
|
||||||
bolt = new Bolt(this);
|
bolt = new Bolt(this);
|
||||||
attachment = new Attachment(this);
|
attachment = new Attachment(this);
|
||||||
perk = new Perks(this);
|
perk = new Perks(this);
|
||||||
|
|
||||||
|
ammo = new IntValue(data, "Ammo");
|
||||||
|
fireMode = new IntValue(data, "FireMode", (int) getGunData("FireMode"));
|
||||||
|
level = new IntValue(data, "Level");
|
||||||
|
exp = new DoubleValue(data, "Exp");
|
||||||
|
upgradePoint = new DoubleValue(data, "UpgradePoint");
|
||||||
|
|
||||||
|
canImmediatelyShoot = new BooleanValue(data, "CanImmediatelyShoot");
|
||||||
|
DA = new BooleanValue(data, "DA");
|
||||||
|
isEmpty = new BooleanValue(data, "IsEmpty");
|
||||||
|
closeHammer = new BooleanValue(data, "CloseHammer");
|
||||||
|
stopped = new BooleanValue(data, "Stopped");
|
||||||
|
forceStop = new BooleanValue(data, "ForceStop");
|
||||||
|
loadIndex = new IntValue(data, "LoadIndex");
|
||||||
|
maxAmmo = new IntValue(data, "MaxAmmo");
|
||||||
}
|
}
|
||||||
|
|
||||||
private CompoundTag getOrPut(String name) {
|
private CompoundTag getOrPut(String name) {
|
||||||
|
@ -107,6 +125,9 @@ public class GunData {
|
||||||
return getGunData(key, 0);
|
return getGunData(key, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 枪械本体属性开始
|
||||||
|
|
||||||
private double getGunData(String key, double defaultValue) {
|
private double getGunData(String key, double defaultValue) {
|
||||||
return GunsTool.gunsData.getOrDefault(id, new HashMap<>()).getOrDefault(key, defaultValue);
|
return GunsTool.gunsData.getOrDefault(id, new HashMap<>()).getOrDefault(key, defaultValue);
|
||||||
}
|
}
|
||||||
|
@ -183,6 +204,10 @@ public class GunData {
|
||||||
return (int) getGunData("FinishTime");
|
return (int) getGunData("FinishTime");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int defaultActionTime() {
|
||||||
|
return (int) getGunData("BoltActionTime") + item.getCustomBoltActionTime(stack());
|
||||||
|
}
|
||||||
|
|
||||||
public double soundRadius() {
|
public double soundRadius() {
|
||||||
return getGunData("SoundRadius", 15) + item.getCustomSoundRadius(stack);
|
return getGunData("SoundRadius", 15) + item.getCustomSoundRadius(stack);
|
||||||
}
|
}
|
||||||
|
@ -207,14 +232,6 @@ public class GunData {
|
||||||
return item.getCustomWeight(stack);
|
return item.getCustomWeight(stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int ammo() {
|
|
||||||
return data.getInt("Ammo");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAmmo(int ammo) {
|
|
||||||
data.putInt("Ammo", ammo);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public double defaultZoom() {
|
public double defaultZoom() {
|
||||||
return getGunData("DefaultZoom", 1.25);
|
return getGunData("DefaultZoom", 1.25);
|
||||||
|
@ -244,40 +261,15 @@ public class GunData {
|
||||||
return (int) getGunData("BurstAmount");
|
return (int) getGunData("BurstAmount");
|
||||||
}
|
}
|
||||||
|
|
||||||
public int fireMode() {
|
|
||||||
if (data.contains("FireMode")) {
|
|
||||||
return data.getInt("FireMode");
|
|
||||||
}
|
|
||||||
return (int) getGunData("FireMode");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFireMode(int fireMode) {
|
// 可持久化属性开始
|
||||||
data.putInt("FireMode", fireMode);
|
|
||||||
}
|
|
||||||
|
|
||||||
public int level() {
|
|
||||||
return data.getInt("Level");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLevel(int level) {
|
public final IntValue ammo;
|
||||||
data.putInt("Level", level);
|
public final IntValue fireMode;
|
||||||
}
|
public final IntValue level;
|
||||||
|
public final DoubleValue exp;
|
||||||
public double exp() {
|
public final DoubleValue upgradePoint;
|
||||||
return data.getDouble("Exp");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setExp(double exp) {
|
|
||||||
data.putDouble("Exp", exp);
|
|
||||||
}
|
|
||||||
|
|
||||||
public double upgradePoint() {
|
|
||||||
return data.getDouble("UpgradePoint");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUpgradePoint(double upgradePoint) {
|
|
||||||
data.putDouble("UpgradePoint", upgradePoint);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean canAdjustZoom() {
|
public boolean canAdjustZoom() {
|
||||||
return item.canAdjustZoom(stack);
|
return item.canAdjustZoom(stack);
|
||||||
|
@ -300,101 +292,17 @@ public class GunData {
|
||||||
return charge.time() > 0;
|
return charge.time() > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canImmediatelyShoot() {
|
public final BooleanValue canImmediatelyShoot;
|
||||||
return data.getBoolean("CanImmediatelyShoot");
|
public final BooleanValue DA;
|
||||||
}
|
public final BooleanValue isEmpty;
|
||||||
|
public final BooleanValue closeHammer;
|
||||||
|
public final BooleanValue stopped;
|
||||||
|
public final BooleanValue forceStop;
|
||||||
|
public final IntValue loadIndex;
|
||||||
|
public final IntValue maxAmmo;
|
||||||
|
|
||||||
public void setCanImmediatelyShoot(boolean value) {
|
|
||||||
if (!value) {
|
|
||||||
data.remove("CanImmediatelyShoot");
|
|
||||||
} else {
|
|
||||||
data.putBoolean("CanImmediatelyShoot", true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean DA() {
|
// 其他子级属性
|
||||||
return data.getBoolean("DA");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDA(boolean value) {
|
|
||||||
if (!value) {
|
|
||||||
data.remove("DA");
|
|
||||||
} else {
|
|
||||||
data.putBoolean("DA", true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isEmpty() {
|
|
||||||
return data.getBoolean("IsEmpty");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setIsEmpty(boolean value) {
|
|
||||||
if (!value) {
|
|
||||||
data.remove("IsEmpty");
|
|
||||||
} else {
|
|
||||||
data.putBoolean("IsEmpty", true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean closeHammer() {
|
|
||||||
return data.getBoolean("CloseHammer");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCloseHammer(boolean value) {
|
|
||||||
if (!value) {
|
|
||||||
data.remove("CloseHammer");
|
|
||||||
} else {
|
|
||||||
data.putBoolean("CloseHammer", true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean stopped() {
|
|
||||||
return data.getBoolean("Stopped");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setStopped(boolean value) {
|
|
||||||
if (!value) {
|
|
||||||
data.remove("Stopped");
|
|
||||||
} else {
|
|
||||||
data.putBoolean("Stopped", true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean forceStop() {
|
|
||||||
return data.getBoolean("ForceStop");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setForceStop(boolean value) {
|
|
||||||
if (!value) {
|
|
||||||
data.remove("ForceStop");
|
|
||||||
} else {
|
|
||||||
data.putBoolean("ForceStop", true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public int loadIndex() {
|
|
||||||
return data.getInt("LoadIndex");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLoadIndex(int value) {
|
|
||||||
if (value == 0) {
|
|
||||||
data.remove("LoadIndex");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
data.putInt("LoadIndex", value);
|
|
||||||
}
|
|
||||||
|
|
||||||
public int maxAmmo() {
|
|
||||||
return data.getInt("MaxAmmo");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMaxAmmo(int value) {
|
|
||||||
if (value == 0) {
|
|
||||||
data.remove("MaxAmmo");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
data.putInt("MaxAmmo", value);
|
|
||||||
}
|
|
||||||
|
|
||||||
public final Bolt bolt;
|
public final Bolt bolt;
|
||||||
public final Attachment attachment;
|
public final Attachment attachment;
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
package com.atsuishio.superbwarfare.item.gun.data;
|
package com.atsuishio.superbwarfare.item.gun.data.subdata;
|
||||||
|
|
||||||
|
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
||||||
|
import com.atsuishio.superbwarfare.item.gun.data.value.AttachmentType;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
|
|
||||||
public final class Attachment {
|
public final class Attachment {
|
||||||
private final CompoundTag attachment;
|
private final CompoundTag attachment;
|
||||||
|
|
||||||
Attachment(GunData gun) {
|
public Attachment(GunData gun) {
|
||||||
this.attachment = gun.attachment();
|
this.attachment = gun.attachment();
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
package com.atsuishio.superbwarfare.item.gun.data.subdata;
|
||||||
|
|
||||||
|
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
||||||
|
import com.atsuishio.superbwarfare.item.gun.data.value.BooleanValue;
|
||||||
|
import com.atsuishio.superbwarfare.item.gun.data.value.Timer;
|
||||||
|
|
||||||
|
public final class Bolt {
|
||||||
|
|
||||||
|
public Bolt(GunData data) {
|
||||||
|
needed = new BooleanValue(data.data(), "NeedBoltAction");
|
||||||
|
actionTimer = new Timer(data.data(), "BoltActionTime");
|
||||||
|
}
|
||||||
|
|
||||||
|
public final BooleanValue needed;
|
||||||
|
public final Timer actionTimer;
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
package com.atsuishio.superbwarfare.item.gun.data.subdata;
|
||||||
|
|
||||||
|
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
||||||
|
import com.atsuishio.superbwarfare.item.gun.data.value.Starter;
|
||||||
|
import com.atsuishio.superbwarfare.item.gun.data.value.Timer;
|
||||||
|
|
||||||
|
public final class Charge {
|
||||||
|
public final Timer timer;
|
||||||
|
public final Starter starter;
|
||||||
|
|
||||||
|
public Charge(GunData data) {
|
||||||
|
this.timer = new Timer(data.data(), "Charge");
|
||||||
|
this.starter = new Starter(data.data(), "Charge");
|
||||||
|
}
|
||||||
|
|
||||||
|
public int time() {
|
||||||
|
return timer.get();
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,7 +1,8 @@
|
||||||
package com.atsuishio.superbwarfare.item.gun.data;
|
package com.atsuishio.superbwarfare.item.gun.data.subdata;
|
||||||
|
|
||||||
import com.atsuishio.superbwarfare.init.ModPerks;
|
import com.atsuishio.superbwarfare.init.ModPerks;
|
||||||
import com.atsuishio.superbwarfare.item.PerkItem;
|
import com.atsuishio.superbwarfare.item.PerkItem;
|
||||||
|
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
||||||
import com.atsuishio.superbwarfare.perk.Perk;
|
import com.atsuishio.superbwarfare.perk.Perk;
|
||||||
import com.atsuishio.superbwarfare.perk.PerkInstance;
|
import com.atsuishio.superbwarfare.perk.PerkInstance;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
|
@ -13,7 +14,7 @@ import java.util.ArrayList;
|
||||||
public final class Perks {
|
public final class Perks {
|
||||||
private final CompoundTag perks;
|
private final CompoundTag perks;
|
||||||
|
|
||||||
Perks(GunData gun) {
|
public Perks(GunData gun) {
|
||||||
this.perks = gun.perk();
|
this.perks = gun.perk();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
package com.atsuishio.superbwarfare.item.gun.data;
|
package com.atsuishio.superbwarfare.item.gun.data.subdata;
|
||||||
|
|
||||||
|
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
||||||
|
import com.atsuishio.superbwarfare.item.gun.data.value.IntValue;
|
||||||
|
import com.atsuishio.superbwarfare.item.gun.data.value.ReloadState;
|
||||||
|
import com.atsuishio.superbwarfare.item.gun.data.value.Starter;
|
||||||
|
import com.atsuishio.superbwarfare.item.gun.data.value.Timer;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
|
|
||||||
public final class Reload {
|
public final class Reload {
|
||||||
|
@ -15,7 +20,7 @@ public final class Reload {
|
||||||
public final Starter singleReloadStarter;
|
public final Starter singleReloadStarter;
|
||||||
public final Starter stage3Starter;
|
public final Starter stage3Starter;
|
||||||
|
|
||||||
Reload(GunData data) {
|
public Reload(GunData data) {
|
||||||
this.data = data.data();
|
this.data = data.data();
|
||||||
|
|
||||||
reloadTimer = new Timer(this.data, "Reload");
|
reloadTimer = new Timer(this.data, "Reload");
|
||||||
|
@ -27,6 +32,8 @@ public final class Reload {
|
||||||
reloadStarter = new Starter(this.data, "Reload");
|
reloadStarter = new Starter(this.data, "Reload");
|
||||||
singleReloadStarter = new Starter(this.data, "SingleReload");
|
singleReloadStarter = new Starter(this.data, "SingleReload");
|
||||||
stage3Starter = new Starter(this.data, "Stage3Forcefully");
|
stage3Starter = new Starter(this.data, "Stage3Forcefully");
|
||||||
|
|
||||||
|
stage = new IntValue(this.data, "ReloadStage");
|
||||||
}
|
}
|
||||||
|
|
||||||
public ReloadState state() {
|
public ReloadState state() {
|
||||||
|
@ -53,16 +60,14 @@ public final class Reload {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public final IntValue stage;
|
||||||
|
|
||||||
public int stage() {
|
public int stage() {
|
||||||
return data.getInt("ReloadStage");
|
return stage.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStage(int stage) {
|
public void setStage(int stage) {
|
||||||
if (stage <= 0) {
|
this.stage.set(stage);
|
||||||
data.remove("ReloadStage");
|
|
||||||
} else {
|
|
||||||
data.putInt("ReloadStage", stage);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package com.atsuishio.superbwarfare.item.gun.data;
|
package com.atsuishio.superbwarfare.item.gun.data.value;
|
||||||
|
|
||||||
public enum AttachmentType {
|
public enum AttachmentType {
|
||||||
SCOPE("Scope"),
|
SCOPE("Scope"),
|
|
@ -0,0 +1,38 @@
|
||||||
|
package com.atsuishio.superbwarfare.item.gun.data.value;
|
||||||
|
|
||||||
|
import net.minecraft.nbt.CompoundTag;
|
||||||
|
|
||||||
|
public class BooleanValue {
|
||||||
|
private final CompoundTag tag;
|
||||||
|
private final String name;
|
||||||
|
private final boolean defaultValue;
|
||||||
|
|
||||||
|
public BooleanValue(CompoundTag tag, String name, boolean defaultValue) {
|
||||||
|
this.tag = tag;
|
||||||
|
this.name = name;
|
||||||
|
this.defaultValue = defaultValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BooleanValue(CompoundTag tag, String name) {
|
||||||
|
this(tag, name, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean get() {
|
||||||
|
if (tag.contains(name)) {
|
||||||
|
return tag.getBoolean(name);
|
||||||
|
}
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void set(boolean value) {
|
||||||
|
if (value == defaultValue) {
|
||||||
|
tag.remove(name);
|
||||||
|
} else {
|
||||||
|
tag.putBoolean(name, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reset() {
|
||||||
|
set(defaultValue);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
package com.atsuishio.superbwarfare.item.gun.data.value;
|
||||||
|
|
||||||
|
import net.minecraft.nbt.CompoundTag;
|
||||||
|
|
||||||
|
public class DoubleValue {
|
||||||
|
private final CompoundTag tag;
|
||||||
|
private final String name;
|
||||||
|
private final double defaultValue;
|
||||||
|
|
||||||
|
public DoubleValue(CompoundTag tag, String name, double defaultValue) {
|
||||||
|
this.tag = tag;
|
||||||
|
this.name = name;
|
||||||
|
this.defaultValue = defaultValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DoubleValue(CompoundTag tag, String name) {
|
||||||
|
this(tag, name, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public double get() {
|
||||||
|
if (tag.contains(name)) {
|
||||||
|
return tag.getDouble(name);
|
||||||
|
}
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void set(double value) {
|
||||||
|
if (value == defaultValue) {
|
||||||
|
tag.remove(name);
|
||||||
|
} else {
|
||||||
|
tag.putDouble(name, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reset() {
|
||||||
|
set(defaultValue);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
package com.atsuishio.superbwarfare.item.gun.data.value;
|
||||||
|
|
||||||
|
import net.minecraft.nbt.CompoundTag;
|
||||||
|
|
||||||
|
public class IntValue {
|
||||||
|
private final CompoundTag tag;
|
||||||
|
private final String name;
|
||||||
|
private final int defaultValue;
|
||||||
|
|
||||||
|
public IntValue(CompoundTag tag, String name, int defaultValue) {
|
||||||
|
this.tag = tag;
|
||||||
|
this.name = name;
|
||||||
|
this.defaultValue = defaultValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IntValue(CompoundTag tag, String name) {
|
||||||
|
this(tag, name, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int get() {
|
||||||
|
if (tag.contains(name)) {
|
||||||
|
return tag.getInt(name);
|
||||||
|
}
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void set(int value) {
|
||||||
|
if (value == defaultValue) {
|
||||||
|
tag.remove(name);
|
||||||
|
} else {
|
||||||
|
tag.putInt(name, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reset() {
|
||||||
|
set(defaultValue);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package com.atsuishio.superbwarfare.item.gun.data;
|
package com.atsuishio.superbwarfare.item.gun.data.value;
|
||||||
|
|
||||||
public enum ReloadState {
|
public enum ReloadState {
|
||||||
NOT_RELOADING,
|
NOT_RELOADING,
|
|
@ -1,12 +1,15 @@
|
||||||
package com.atsuishio.superbwarfare.item.gun.data;
|
package com.atsuishio.superbwarfare.item.gun.data.value;
|
||||||
|
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 标记某种状态是否应该开始
|
||||||
|
*/
|
||||||
public class Starter {
|
public class Starter {
|
||||||
private final CompoundTag tag;
|
private final CompoundTag tag;
|
||||||
private final String name;
|
private final String name;
|
||||||
|
|
||||||
Starter(CompoundTag tag, String name) {
|
public Starter(CompoundTag tag, String name) {
|
||||||
this.tag = tag;
|
this.tag = tag;
|
||||||
this.name = "Start" + name;
|
this.name = "Start" + name;
|
||||||
}
|
}
|
|
@ -1,12 +1,15 @@
|
||||||
package com.atsuishio.superbwarfare.item.gun.data;
|
package com.atsuishio.superbwarfare.item.gun.data.value;
|
||||||
|
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 针对一种状态的计时器
|
||||||
|
*/
|
||||||
public class Timer {
|
public class Timer {
|
||||||
private final CompoundTag tag;
|
private final CompoundTag tag;
|
||||||
public final String name;
|
public final String name;
|
||||||
|
|
||||||
Timer(CompoundTag tag, String name) {
|
public Timer(CompoundTag tag, String name) {
|
||||||
this.tag = tag;
|
this.tag = tag;
|
||||||
this.name = name + "Time";
|
this.name = name + "Time";
|
||||||
}
|
}
|
|
@ -7,8 +7,8 @@ import com.atsuishio.superbwarfare.init.ModAttachments;
|
||||||
import com.atsuishio.superbwarfare.init.ModSounds;
|
import com.atsuishio.superbwarfare.init.ModSounds;
|
||||||
import com.atsuishio.superbwarfare.init.ModTags;
|
import com.atsuishio.superbwarfare.init.ModTags;
|
||||||
import com.atsuishio.superbwarfare.item.gun.GunItem;
|
import com.atsuishio.superbwarfare.item.gun.GunItem;
|
||||||
import com.atsuishio.superbwarfare.item.gun.data.AttachmentType;
|
|
||||||
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
||||||
|
import com.atsuishio.superbwarfare.item.gun.data.value.AttachmentType;
|
||||||
import com.atsuishio.superbwarfare.perk.Perk;
|
import com.atsuishio.superbwarfare.perk.Perk;
|
||||||
import com.atsuishio.superbwarfare.perk.PerkHelper;
|
import com.atsuishio.superbwarfare.perk.PerkHelper;
|
||||||
import com.atsuishio.superbwarfare.tools.NBTTool;
|
import com.atsuishio.superbwarfare.tools.NBTTool;
|
||||||
|
@ -108,7 +108,7 @@ public class Trachelium extends GunItem implements GeoItem {
|
||||||
boolean stock = data.attachment.get(AttachmentType.STOCK) == 2;
|
boolean stock = data.attachment.get(AttachmentType.STOCK) == 2;
|
||||||
boolean grip = data.attachment.get(AttachmentType.GRIP) > 0 || data.attachment.get(AttachmentType.SCOPE) > 0;
|
boolean grip = data.attachment.get(AttachmentType.GRIP) > 0 || data.attachment.get(AttachmentType.SCOPE) > 0;
|
||||||
|
|
||||||
if (data.bolt.actionTime() > 0) {
|
if (data.bolt.actionTimer.get() > 0) {
|
||||||
if (stock) {
|
if (stock) {
|
||||||
if (grip) {
|
if (grip) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.trachelium.action_stock_grip"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.trachelium.action_stock_grip"));
|
||||||
|
@ -248,7 +248,7 @@ public class Trachelium extends GunItem implements GeoItem {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getCustomBoltActionTime(ItemStack stack) {
|
public int getCustomBoltActionTime(ItemStack stack) {
|
||||||
return GunData.from(stack).DA() ? 12 : 0;
|
return GunData.from(stack).DA.get() ? 12 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -8,8 +8,8 @@ import com.atsuishio.superbwarfare.init.ModEnumExtensions;
|
||||||
import com.atsuishio.superbwarfare.init.ModSounds;
|
import com.atsuishio.superbwarfare.init.ModSounds;
|
||||||
import com.atsuishio.superbwarfare.init.ModTags;
|
import com.atsuishio.superbwarfare.init.ModTags;
|
||||||
import com.atsuishio.superbwarfare.item.gun.GunItem;
|
import com.atsuishio.superbwarfare.item.gun.GunItem;
|
||||||
import com.atsuishio.superbwarfare.item.gun.data.AttachmentType;
|
|
||||||
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
||||||
|
import com.atsuishio.superbwarfare.item.gun.data.value.AttachmentType;
|
||||||
import com.atsuishio.superbwarfare.perk.Perk;
|
import com.atsuishio.superbwarfare.perk.Perk;
|
||||||
import com.atsuishio.superbwarfare.perk.PerkHelper;
|
import com.atsuishio.superbwarfare.perk.PerkHelper;
|
||||||
import com.atsuishio.superbwarfare.tools.GunsTool;
|
import com.atsuishio.superbwarfare.tools.GunsTool;
|
||||||
|
@ -58,7 +58,7 @@ public class Ntw20Item extends GunItem implements GeoItem {
|
||||||
if (!stack.is(ModTags.Items.GUN)) return PlayState.STOP;
|
if (!stack.is(ModTags.Items.GUN)) return PlayState.STOP;
|
||||||
var data = GunData.from(stack);
|
var data = GunData.from(stack);
|
||||||
|
|
||||||
if (data.bolt.actionTime() > 0) {
|
if (data.bolt.actionTimer.get() > 0) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.ntw_20.shift"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.ntw_20.shift"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ public class Ntw20Item extends GunItem implements GeoItem {
|
||||||
&& ClientEventHandler.cantSprint == 0
|
&& ClientEventHandler.cantSprint == 0
|
||||||
&& !(data.reload.normal() || data.reload.empty())
|
&& !(data.reload.normal() || data.reload.empty())
|
||||||
&& ClientEventHandler.drawTime < 0.01) {
|
&& ClientEventHandler.drawTime < 0.01) {
|
||||||
if (ClientEventHandler.tacticalSprint && data.bolt.actionTime() == 0) {
|
if (ClientEventHandler.tacticalSprint && data.bolt.actionTimer.get() == 0) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.ntw_20.run_fast"));
|
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.ntw_20.run_fast"));
|
||||||
} else {
|
} else {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.ntw_20.run"));
|
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.ntw_20.run"));
|
||||||
|
|
|
@ -136,7 +136,7 @@ public class JavelinItem extends GunItem implements GeoItem, SpecialFireWeapon {
|
||||||
final var tag = data.tag();
|
final var tag = data.tag();
|
||||||
|
|
||||||
if (entity instanceof Player player && selected) {
|
if (entity instanceof Player player && selected) {
|
||||||
data.setMaxAmmo(getAmmoCount(player));
|
data.maxAmmo.set(getAmmoCount(player));
|
||||||
|
|
||||||
if (tag.getBoolean("Seeking")) {
|
if (tag.getBoolean("Seeking")) {
|
||||||
|
|
||||||
|
@ -288,7 +288,7 @@ public class JavelinItem extends GunItem implements GeoItem, SpecialFireWeapon {
|
||||||
}
|
}
|
||||||
|
|
||||||
player.getCooldowns().addCooldown(stack.getItem(), 10);
|
player.getCooldowns().addCooldown(stack.getItem(), 10);
|
||||||
data.setAmmo(data.ammo() - 1);
|
data.ammo.set(data.ammo.get() - 1);
|
||||||
data.save();
|
data.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -309,7 +309,7 @@ public class JavelinItem extends GunItem implements GeoItem, SpecialFireWeapon {
|
||||||
public void fireOnPress(Player player, final GunData data, boolean zoom) {
|
public void fireOnPress(Player player, final GunData data, boolean zoom) {
|
||||||
var tag = data.tag();
|
var tag = data.tag();
|
||||||
|
|
||||||
if (!zoom || data.ammo() <= 0) return;
|
if (!zoom || data.ammo.get() <= 0) return;
|
||||||
|
|
||||||
Entity seekingEntity = SeekTool.seekEntity(player, player.level(), 512, 8);
|
Entity seekingEntity = SeekTool.seekEntity(player, player.level(), 512, 8);
|
||||||
|
|
||||||
|
|
|
@ -127,7 +127,7 @@ public class M79Item extends GunItem implements GeoItem, SpecialFireWeapon {
|
||||||
super.inventoryTick(stack, world, entity, slot, selected);
|
super.inventoryTick(stack, world, entity, slot, selected);
|
||||||
if (entity instanceof Player player) {
|
if (entity instanceof Player player) {
|
||||||
var data = GunData.from(stack);
|
var data = GunData.from(stack);
|
||||||
data.setMaxAmmo(getAmmoCount(player));
|
data.maxAmmo.set(getAmmoCount(player));
|
||||||
data.save();
|
data.save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -170,7 +170,7 @@ public class M79Item extends GunItem implements GeoItem, SpecialFireWeapon {
|
||||||
public void fireOnPress(Player player, final GunData data, boolean zoom) {
|
public void fireOnPress(Player player, final GunData data, boolean zoom) {
|
||||||
if (data.reloading()) return;
|
if (data.reloading()) return;
|
||||||
ItemStack stack = data.stack();
|
ItemStack stack = data.stack();
|
||||||
if (player.getCooldowns().isOnCooldown(stack.getItem()) || data.ammo() <= 0) return;
|
if (player.getCooldowns().isOnCooldown(stack.getItem()) || data.ammo.get() <= 0) return;
|
||||||
|
|
||||||
double spread = data.spread();
|
double spread = data.spread();
|
||||||
|
|
||||||
|
@ -218,7 +218,7 @@ public class M79Item extends GunItem implements GeoItem, SpecialFireWeapon {
|
||||||
}
|
}
|
||||||
|
|
||||||
player.getCooldowns().addCooldown(stack.getItem(), 2);
|
player.getCooldowns().addCooldown(stack.getItem(), 2);
|
||||||
data.setAmmo(data.ammo() - 1);
|
data.ammo.set(data.ammo.get() - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -137,13 +137,13 @@ public class RpgItem extends GunItem implements GeoItem, SpecialFireWeapon {
|
||||||
if (tag.getBoolean("draw")) {
|
if (tag.getBoolean("draw")) {
|
||||||
tag.putBoolean("draw", false);
|
tag.putBoolean("draw", false);
|
||||||
|
|
||||||
if (data.ammo() == 0) {
|
if (data.ammo.get() == 0) {
|
||||||
data.setIsEmpty(true);
|
data.isEmpty.set(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entity instanceof Player player) {
|
if (entity instanceof Player player) {
|
||||||
data.setMaxAmmo(getAmmoCount(player));
|
data.maxAmmo.set(getAmmoCount(player));
|
||||||
}
|
}
|
||||||
data.save();
|
data.save();
|
||||||
|
|
||||||
|
@ -186,7 +186,7 @@ public class RpgItem extends GunItem implements GeoItem, SpecialFireWeapon {
|
||||||
|
|
||||||
if (data.reloading()
|
if (data.reloading()
|
||||||
|| player.getCooldowns().isOnCooldown(stack.getItem())
|
|| player.getCooldowns().isOnCooldown(stack.getItem())
|
||||||
|| data.ammo() <= 0
|
|| data.ammo.get() <= 0
|
||||||
) return;
|
) return;
|
||||||
|
|
||||||
double spread = data.spread();
|
double spread = data.spread();
|
||||||
|
@ -237,21 +237,21 @@ public class RpgItem extends GunItem implements GeoItem, SpecialFireWeapon {
|
||||||
PacketDistributor.sendToPlayer(serverPlayer, new ShootClientMessage(10));
|
PacketDistributor.sendToPlayer(serverPlayer, new ShootClientMessage(10));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.ammo() == 1) {
|
if (data.ammo.get() == 1) {
|
||||||
data.setIsEmpty(true);
|
data.isEmpty.set(true);
|
||||||
data.setCloseHammer(true);
|
data.closeHammer.set(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
player.getCooldowns().addCooldown(stack.getItem(), 10);
|
player.getCooldowns().addCooldown(stack.getItem(), 10);
|
||||||
data.setAmmo(data.ammo() - 1);
|
data.ammo.set(data.ammo.get() - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addReloadTimeBehavior(Map<Integer, Consumer<GunData>> behaviors) {
|
public void addReloadTimeBehavior(Map<Integer, Consumer<GunData>> behaviors) {
|
||||||
super.addReloadTimeBehavior(behaviors);
|
super.addReloadTimeBehavior(behaviors);
|
||||||
|
|
||||||
behaviors.put(84, data -> data.setIsEmpty(false));
|
behaviors.put(84, data -> data.isEmpty.set(false));
|
||||||
behaviors.put(9, data -> data.setCloseHammer(false));
|
behaviors.put(9, data -> data.closeHammer.set(false));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -91,11 +91,11 @@ public class SecondaryCataclysm extends GunItem implements GeoItem, SpecialFireW
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.sc.prepare"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.sc.prepare"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.loadIndex() == 0 && data.reload.stage() == 2) {
|
if (data.loadIndex.get() == 0 && data.reload.stage() == 2) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.sc.iterativeload"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.sc.iterativeload"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.loadIndex() == 1 && data.reload.stage() == 2) {
|
if (data.loadIndex.get() == 1 && data.reload.stage() == 2) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.sc.iterativeload2"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.sc.iterativeload2"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -178,7 +178,7 @@ public class SecondaryCataclysm extends GunItem implements GeoItem, SpecialFireW
|
||||||
|
|
||||||
if (entity instanceof Player player) {
|
if (entity instanceof Player player) {
|
||||||
var data = GunData.from(stack);
|
var data = GunData.from(stack);
|
||||||
data.setMaxAmmo(getAmmoCount(player));
|
data.maxAmmo.set(getAmmoCount(player));
|
||||||
data.save();
|
data.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -268,7 +268,7 @@ public class SecondaryCataclysm extends GunItem implements GeoItem, SpecialFireW
|
||||||
public void fireOnPress(Player player, final GunData data, boolean zoom) {
|
public void fireOnPress(Player player, final GunData data, boolean zoom) {
|
||||||
if (data.reloading()) return;
|
if (data.reloading()) return;
|
||||||
ItemStack stack = data.stack();
|
ItemStack stack = data.stack();
|
||||||
if (player.getCooldowns().isOnCooldown(stack.getItem()) || data.ammo() <= 0) return;
|
if (player.getCooldowns().isOnCooldown(stack.getItem()) || data.ammo.get() <= 0) return;
|
||||||
|
|
||||||
double spread = data.spread();
|
double spread = data.spread();
|
||||||
|
|
||||||
|
@ -334,7 +334,7 @@ public class SecondaryCataclysm extends GunItem implements GeoItem, SpecialFireW
|
||||||
PacketDistributor.sendToPlayer(serverPlayer, new ShootClientMessage(10));
|
PacketDistributor.sendToPlayer(serverPlayer, new ShootClientMessage(10));
|
||||||
}
|
}
|
||||||
|
|
||||||
data.setAmmo(data.ammo() - 1);
|
data.ammo.set(data.ammo.get() - 1);
|
||||||
player.getCooldowns().addCooldown(stack.getItem(), 6);
|
player.getCooldowns().addCooldown(stack.getItem(), 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -113,7 +113,7 @@ public class M60Item extends GunItem implements GeoItem {
|
||||||
if (tag.getBoolean("draw")) {
|
if (tag.getBoolean("draw")) {
|
||||||
tag.putBoolean("draw", false);
|
tag.putBoolean("draw", false);
|
||||||
|
|
||||||
if (data.ammo() <= 5) {
|
if (data.ammo.get() <= 5) {
|
||||||
GunsTool.setGunBooleanTag(tag, "HideBulletChain", true);
|
GunsTool.setGunBooleanTag(tag, "HideBulletChain", true);
|
||||||
}
|
}
|
||||||
data.save();
|
data.save();
|
||||||
|
|
|
@ -8,8 +8,8 @@ import com.atsuishio.superbwarfare.init.ModPerks;
|
||||||
import com.atsuishio.superbwarfare.init.ModSounds;
|
import com.atsuishio.superbwarfare.init.ModSounds;
|
||||||
import com.atsuishio.superbwarfare.init.ModTags;
|
import com.atsuishio.superbwarfare.init.ModTags;
|
||||||
import com.atsuishio.superbwarfare.item.gun.GunItem;
|
import com.atsuishio.superbwarfare.item.gun.GunItem;
|
||||||
import com.atsuishio.superbwarfare.item.gun.data.AttachmentType;
|
|
||||||
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
||||||
|
import com.atsuishio.superbwarfare.item.gun.data.value.AttachmentType;
|
||||||
import com.atsuishio.superbwarfare.perk.Perk;
|
import com.atsuishio.superbwarfare.perk.Perk;
|
||||||
import com.atsuishio.superbwarfare.perk.PerkHelper;
|
import com.atsuishio.superbwarfare.perk.PerkHelper;
|
||||||
import com.atsuishio.superbwarfare.tools.GunsTool;
|
import com.atsuishio.superbwarfare.tools.GunsTool;
|
||||||
|
|
|
@ -7,8 +7,8 @@ import com.atsuishio.superbwarfare.init.ModAttachments;
|
||||||
import com.atsuishio.superbwarfare.init.ModSounds;
|
import com.atsuishio.superbwarfare.init.ModSounds;
|
||||||
import com.atsuishio.superbwarfare.init.ModTags;
|
import com.atsuishio.superbwarfare.init.ModTags;
|
||||||
import com.atsuishio.superbwarfare.item.gun.GunItem;
|
import com.atsuishio.superbwarfare.item.gun.GunItem;
|
||||||
import com.atsuishio.superbwarfare.item.gun.data.AttachmentType;
|
|
||||||
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
||||||
|
import com.atsuishio.superbwarfare.item.gun.data.value.AttachmentType;
|
||||||
import com.atsuishio.superbwarfare.perk.Perk;
|
import com.atsuishio.superbwarfare.perk.Perk;
|
||||||
import com.atsuishio.superbwarfare.perk.PerkHelper;
|
import com.atsuishio.superbwarfare.perk.PerkHelper;
|
||||||
import com.atsuishio.superbwarfare.tools.GunsTool;
|
import com.atsuishio.superbwarfare.tools.GunsTool;
|
||||||
|
|
|
@ -7,8 +7,8 @@ import com.atsuishio.superbwarfare.init.ModAttachments;
|
||||||
import com.atsuishio.superbwarfare.init.ModSounds;
|
import com.atsuishio.superbwarfare.init.ModSounds;
|
||||||
import com.atsuishio.superbwarfare.init.ModTags;
|
import com.atsuishio.superbwarfare.init.ModTags;
|
||||||
import com.atsuishio.superbwarfare.item.gun.GunItem;
|
import com.atsuishio.superbwarfare.item.gun.GunItem;
|
||||||
import com.atsuishio.superbwarfare.item.gun.data.AttachmentType;
|
|
||||||
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
||||||
|
import com.atsuishio.superbwarfare.item.gun.data.value.AttachmentType;
|
||||||
import com.atsuishio.superbwarfare.perk.Perk;
|
import com.atsuishio.superbwarfare.perk.Perk;
|
||||||
import com.atsuishio.superbwarfare.perk.PerkHelper;
|
import com.atsuishio.superbwarfare.perk.PerkHelper;
|
||||||
import com.atsuishio.superbwarfare.tools.GunsTool;
|
import com.atsuishio.superbwarfare.tools.GunsTool;
|
||||||
|
|
|
@ -7,8 +7,8 @@ import com.atsuishio.superbwarfare.init.ModAttachments;
|
||||||
import com.atsuishio.superbwarfare.init.ModSounds;
|
import com.atsuishio.superbwarfare.init.ModSounds;
|
||||||
import com.atsuishio.superbwarfare.init.ModTags;
|
import com.atsuishio.superbwarfare.init.ModTags;
|
||||||
import com.atsuishio.superbwarfare.item.gun.GunItem;
|
import com.atsuishio.superbwarfare.item.gun.GunItem;
|
||||||
import com.atsuishio.superbwarfare.item.gun.data.AttachmentType;
|
|
||||||
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
||||||
|
import com.atsuishio.superbwarfare.item.gun.data.value.AttachmentType;
|
||||||
import com.atsuishio.superbwarfare.perk.Perk;
|
import com.atsuishio.superbwarfare.perk.Perk;
|
||||||
import com.atsuishio.superbwarfare.perk.PerkHelper;
|
import com.atsuishio.superbwarfare.perk.PerkHelper;
|
||||||
import com.atsuishio.superbwarfare.tools.GunsTool;
|
import com.atsuishio.superbwarfare.tools.GunsTool;
|
||||||
|
|
|
@ -7,8 +7,8 @@ import com.atsuishio.superbwarfare.init.ModAttachments;
|
||||||
import com.atsuishio.superbwarfare.init.ModSounds;
|
import com.atsuishio.superbwarfare.init.ModSounds;
|
||||||
import com.atsuishio.superbwarfare.init.ModTags;
|
import com.atsuishio.superbwarfare.init.ModTags;
|
||||||
import com.atsuishio.superbwarfare.item.gun.GunItem;
|
import com.atsuishio.superbwarfare.item.gun.GunItem;
|
||||||
import com.atsuishio.superbwarfare.item.gun.data.AttachmentType;
|
|
||||||
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
||||||
|
import com.atsuishio.superbwarfare.item.gun.data.value.AttachmentType;
|
||||||
import com.atsuishio.superbwarfare.perk.Perk;
|
import com.atsuishio.superbwarfare.perk.Perk;
|
||||||
import com.atsuishio.superbwarfare.perk.PerkHelper;
|
import com.atsuishio.superbwarfare.perk.PerkHelper;
|
||||||
import com.atsuishio.superbwarfare.tools.GunsTool;
|
import com.atsuishio.superbwarfare.tools.GunsTool;
|
||||||
|
|
|
@ -49,7 +49,7 @@ public class MarlinItem extends GunItem implements GeoItem {
|
||||||
if (!stack.is(ModTags.Items.GUN)) return PlayState.STOP;
|
if (!stack.is(ModTags.Items.GUN)) return PlayState.STOP;
|
||||||
var data = GunData.from(stack);
|
var data = GunData.from(stack);
|
||||||
|
|
||||||
if (data.bolt.actionTime() > 0) {
|
if (data.bolt.actionTimer.get() > 0) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.marlin.shift"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.marlin.shift"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,11 +57,11 @@ public class MarlinItem extends GunItem implements GeoItem {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.marlin.prepare"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.marlin.prepare"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.loadIndex() == 0 && data.reload.stage() == 2) {
|
if (data.loadIndex.get() == 0 && data.reload.stage() == 2) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.marlin.iterativeload"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.marlin.iterativeload"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.loadIndex() == 1 && data.reload.stage() == 2) {
|
if (data.loadIndex.get() == 1 && data.reload.stage() == 2) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.marlin.iterativeload2"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.marlin.iterativeload2"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,8 @@ import com.atsuishio.superbwarfare.init.ModAttachments;
|
||||||
import com.atsuishio.superbwarfare.init.ModSounds;
|
import com.atsuishio.superbwarfare.init.ModSounds;
|
||||||
import com.atsuishio.superbwarfare.init.ModTags;
|
import com.atsuishio.superbwarfare.init.ModTags;
|
||||||
import com.atsuishio.superbwarfare.item.gun.GunItem;
|
import com.atsuishio.superbwarfare.item.gun.GunItem;
|
||||||
import com.atsuishio.superbwarfare.item.gun.data.AttachmentType;
|
|
||||||
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
||||||
|
import com.atsuishio.superbwarfare.item.gun.data.value.AttachmentType;
|
||||||
import com.atsuishio.superbwarfare.perk.Perk;
|
import com.atsuishio.superbwarfare.perk.Perk;
|
||||||
import com.atsuishio.superbwarfare.perk.PerkHelper;
|
import com.atsuishio.superbwarfare.perk.PerkHelper;
|
||||||
import com.atsuishio.superbwarfare.tools.GunsTool;
|
import com.atsuishio.superbwarfare.tools.GunsTool;
|
||||||
|
|
|
@ -7,8 +7,8 @@ import com.atsuishio.superbwarfare.init.ModAttachments;
|
||||||
import com.atsuishio.superbwarfare.init.ModSounds;
|
import com.atsuishio.superbwarfare.init.ModSounds;
|
||||||
import com.atsuishio.superbwarfare.init.ModTags;
|
import com.atsuishio.superbwarfare.init.ModTags;
|
||||||
import com.atsuishio.superbwarfare.item.gun.GunItem;
|
import com.atsuishio.superbwarfare.item.gun.GunItem;
|
||||||
import com.atsuishio.superbwarfare.item.gun.data.AttachmentType;
|
|
||||||
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
||||||
|
import com.atsuishio.superbwarfare.item.gun.data.value.AttachmentType;
|
||||||
import com.atsuishio.superbwarfare.perk.Perk;
|
import com.atsuishio.superbwarfare.perk.Perk;
|
||||||
import com.atsuishio.superbwarfare.perk.PerkHelper;
|
import com.atsuishio.superbwarfare.perk.PerkHelper;
|
||||||
import com.atsuishio.superbwarfare.tools.GunsTool;
|
import com.atsuishio.superbwarfare.tools.GunsTool;
|
||||||
|
|
|
@ -97,7 +97,7 @@ public class SksItem extends GunItem implements GeoItem {
|
||||||
if (tag.getBoolean("draw")) {
|
if (tag.getBoolean("draw")) {
|
||||||
tag.putBoolean("draw", false);
|
tag.putBoolean("draw", false);
|
||||||
|
|
||||||
if (data.ammo() == 0) {
|
if (data.ammo.get() == 0) {
|
||||||
GunsTool.setGunBooleanTag(tag, "HoldOpen", true);
|
GunsTool.setGunBooleanTag(tag, "HoldOpen", true);
|
||||||
}
|
}
|
||||||
data.save();
|
data.save();
|
||||||
|
|
|
@ -53,7 +53,7 @@ public class M870Item extends GunItem implements GeoItem {
|
||||||
if (!stack.is(ModTags.Items.GUN)) return PlayState.STOP;
|
if (!stack.is(ModTags.Items.GUN)) return PlayState.STOP;
|
||||||
var data = GunData.from(stack);
|
var data = GunData.from(stack);
|
||||||
|
|
||||||
if (data.bolt.actionTime() > 0) {
|
if (data.bolt.actionTimer.get() > 0) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m870.shift"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m870.shift"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,11 +65,11 @@ public class M870Item extends GunItem implements GeoItem {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m870.prepare"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m870.prepare"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.loadIndex() == 0 && data.reload.stage() == 2) {
|
if (data.loadIndex.get() == 0 && data.reload.stage() == 2) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m870.iterativeload"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m870.iterativeload"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.loadIndex() == 1 && data.reload.stage() == 2) {
|
if (data.loadIndex.get() == 1 && data.reload.stage() == 2) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m870.iterativeload2"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m870.iterativeload2"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,8 @@ import com.atsuishio.superbwarfare.init.ModAttachments;
|
||||||
import com.atsuishio.superbwarfare.init.ModSounds;
|
import com.atsuishio.superbwarfare.init.ModSounds;
|
||||||
import com.atsuishio.superbwarfare.init.ModTags;
|
import com.atsuishio.superbwarfare.init.ModTags;
|
||||||
import com.atsuishio.superbwarfare.item.gun.GunItem;
|
import com.atsuishio.superbwarfare.item.gun.GunItem;
|
||||||
import com.atsuishio.superbwarfare.item.gun.data.AttachmentType;
|
|
||||||
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
||||||
|
import com.atsuishio.superbwarfare.item.gun.data.value.AttachmentType;
|
||||||
import com.atsuishio.superbwarfare.perk.Perk;
|
import com.atsuishio.superbwarfare.perk.Perk;
|
||||||
import com.atsuishio.superbwarfare.perk.PerkHelper;
|
import com.atsuishio.superbwarfare.perk.PerkHelper;
|
||||||
import com.atsuishio.superbwarfare.tools.NBTTool;
|
import com.atsuishio.superbwarfare.tools.NBTTool;
|
||||||
|
|
|
@ -50,7 +50,7 @@ public class K98Item extends GunItem implements GeoItem {
|
||||||
if (!stack.is(ModTags.Items.GUN)) return PlayState.STOP;
|
if (!stack.is(ModTags.Items.GUN)) return PlayState.STOP;
|
||||||
var data = GunData.from(stack);
|
var data = GunData.from(stack);
|
||||||
|
|
||||||
if (data.bolt.actionTime() > 0) {
|
if (data.bolt.actionTimer.get() > 0) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.k98.shift"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.k98.shift"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,11 +62,11 @@ public class K98Item extends GunItem implements GeoItem {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.k98.prepare"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.k98.prepare"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.loadIndex() == 0 && data.reload.stage() == 2) {
|
if (data.loadIndex.get() == 0 && data.reload.stage() == 2) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.k98.iterativeload"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.k98.iterativeload"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.loadIndex() == 1 && data.reload.stage() == 2) {
|
if (data.loadIndex.get() == 1 && data.reload.stage() == 2) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.k98.iterativeload2"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.k98.iterativeload2"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ public class K98Item extends GunItem implements GeoItem {
|
||||||
&& ClientEventHandler.drawTime < 0.01
|
&& ClientEventHandler.drawTime < 0.01
|
||||||
&& !data.reloading()
|
&& !data.reloading()
|
||||||
) {
|
) {
|
||||||
if (ClientEventHandler.tacticalSprint && data.bolt.actionTime() == 0) {
|
if (ClientEventHandler.tacticalSprint && data.bolt.actionTimer.get() == 0) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.k98.run_fast"));
|
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.k98.run_fast"));
|
||||||
} else {
|
} else {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.k98.run"));
|
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.k98.run"));
|
||||||
|
|
|
@ -49,7 +49,7 @@ public class M98bItem extends GunItem implements GeoItem {
|
||||||
if (!stack.is(ModTags.Items.GUN)) return PlayState.STOP;
|
if (!stack.is(ModTags.Items.GUN)) return PlayState.STOP;
|
||||||
var data = GunData.from(stack);
|
var data = GunData.from(stack);
|
||||||
|
|
||||||
if (data.bolt.actionTime() > 0) {
|
if (data.bolt.actionTimer.get() > 0) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m98b.shift"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m98b.shift"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ public class M98bItem extends GunItem implements GeoItem {
|
||||||
if (player.isSprinting() && player.onGround()
|
if (player.isSprinting() && player.onGround()
|
||||||
&& ClientEventHandler.cantSprint == 0
|
&& ClientEventHandler.cantSprint == 0
|
||||||
&& !(data.reload.normal() || data.reload.empty()) && ClientEventHandler.drawTime < 0.01) {
|
&& !(data.reload.normal() || data.reload.empty()) && ClientEventHandler.drawTime < 0.01) {
|
||||||
if (ClientEventHandler.tacticalSprint && data.bolt.actionTime() == 0) {
|
if (ClientEventHandler.tacticalSprint && data.bolt.actionTimer.get() == 0) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.m98b.run_fast"));
|
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.m98b.run_fast"));
|
||||||
} else {
|
} else {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.m98b.run"));
|
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.m98b.run"));
|
||||||
|
|
|
@ -49,23 +49,23 @@ public class MosinNagantItem extends GunItem implements GeoItem {
|
||||||
if (!stack.is(ModTags.Items.GUN)) return PlayState.STOP;
|
if (!stack.is(ModTags.Items.GUN)) return PlayState.STOP;
|
||||||
var data = GunData.from(stack);
|
var data = GunData.from(stack);
|
||||||
|
|
||||||
if (data.bolt.actionTime() > 0) {
|
if (data.bolt.actionTimer.get() > 0) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.mosin.shift"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.mosin.shift"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.reload.stage() == 1 && data.ammo() == 0) {
|
if (data.reload.stage() == 1 && data.ammo.get() == 0) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.mosin.prepare_empty"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.mosin.prepare_empty"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.reload.stage() == 1 && data.ammo() > 0) {
|
if (data.reload.stage() == 1 && data.ammo.get() > 0) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.mosin.prepare"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.mosin.prepare"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.loadIndex() == 0 && data.reload.stage() == 2) {
|
if (data.loadIndex.get() == 0 && data.reload.stage() == 2) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.mosin.iterativeload"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.mosin.iterativeload"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.loadIndex() == 1 && data.reload.stage() == 2) {
|
if (data.loadIndex.get() == 1 && data.reload.stage() == 2) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.mosin.iterativeload2"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.mosin.iterativeload2"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@ public class MosinNagantItem extends GunItem implements GeoItem {
|
||||||
&& ClientEventHandler.drawTime < 0.01
|
&& ClientEventHandler.drawTime < 0.01
|
||||||
&& !data.reloading()
|
&& !data.reloading()
|
||||||
) {
|
) {
|
||||||
if (ClientEventHandler.tacticalSprint && data.bolt.actionTime() == 0) {
|
if (ClientEventHandler.tacticalSprint && data.bolt.actionTimer.get() == 0) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.mosin.run_fast"));
|
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.mosin.run_fast"));
|
||||||
} else {
|
} else {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.mosin.run"));
|
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.mosin.run"));
|
||||||
|
|
|
@ -73,7 +73,7 @@ public class SentinelItem extends GunItem implements GeoItem, EnergyStorageItem
|
||||||
if (!stack.is(ModTags.Items.GUN)) return PlayState.STOP;
|
if (!stack.is(ModTags.Items.GUN)) return PlayState.STOP;
|
||||||
var data = GunData.from(stack);
|
var data = GunData.from(stack);
|
||||||
|
|
||||||
if (data.bolt.actionTime() > 0) {
|
if (data.bolt.actionTimer.get() > 0) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.sentinel.shift"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.sentinel.shift"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ public class SentinelItem extends GunItem implements GeoItem, EnergyStorageItem
|
||||||
&& !data.charging()
|
&& !data.charging()
|
||||||
&& ClientEventHandler.drawTime < 0.01
|
&& ClientEventHandler.drawTime < 0.01
|
||||||
) {
|
) {
|
||||||
if (ClientEventHandler.tacticalSprint && data.bolt.actionTime() == 0) {
|
if (ClientEventHandler.tacticalSprint && data.bolt.actionTimer.get() == 0) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.sentinel.run_fast"));
|
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.sentinel.run_fast"));
|
||||||
} else {
|
} else {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.sentinel.run"));
|
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.sentinel.run"));
|
||||||
|
|
|
@ -7,8 +7,8 @@ import com.atsuishio.superbwarfare.init.ModAttachments;
|
||||||
import com.atsuishio.superbwarfare.init.ModSounds;
|
import com.atsuishio.superbwarfare.init.ModSounds;
|
||||||
import com.atsuishio.superbwarfare.init.ModTags;
|
import com.atsuishio.superbwarfare.init.ModTags;
|
||||||
import com.atsuishio.superbwarfare.item.gun.GunItem;
|
import com.atsuishio.superbwarfare.item.gun.GunItem;
|
||||||
import com.atsuishio.superbwarfare.item.gun.data.AttachmentType;
|
|
||||||
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
||||||
|
import com.atsuishio.superbwarfare.item.gun.data.value.AttachmentType;
|
||||||
import com.atsuishio.superbwarfare.perk.Perk;
|
import com.atsuishio.superbwarfare.perk.Perk;
|
||||||
import com.atsuishio.superbwarfare.perk.PerkHelper;
|
import com.atsuishio.superbwarfare.perk.PerkHelper;
|
||||||
import com.atsuishio.superbwarfare.tools.GunsTool;
|
import com.atsuishio.superbwarfare.tools.GunsTool;
|
||||||
|
|
|
@ -117,7 +117,7 @@ public class BocekItem extends GunItem implements GeoItem, SpecialFireWeapon {
|
||||||
var data = GunData.from(stack);
|
var data = GunData.from(stack);
|
||||||
final var tag = data.tag();
|
final var tag = data.tag();
|
||||||
if (entity instanceof Player player) {
|
if (entity instanceof Player player) {
|
||||||
data.setMaxAmmo(getAmmoCount(player));
|
data.maxAmmo.set(getAmmoCount(player));
|
||||||
data.save();
|
data.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -146,7 +146,7 @@ public class TaserItem extends GunItem implements GeoItem, SpecialFireWeapon, En
|
||||||
var data = GunData.from(stack);
|
var data = GunData.from(stack);
|
||||||
|
|
||||||
if (entity instanceof Player player) {
|
if (entity instanceof Player player) {
|
||||||
data.setMaxAmmo(getAmmoCount(player));
|
data.maxAmmo.set(getAmmoCount(player));
|
||||||
data.save();
|
data.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -228,7 +228,7 @@ public class TaserItem extends GunItem implements GeoItem, SpecialFireWeapon, En
|
||||||
var hasEnoughEnergy = energyStorage != null && energyStorage.getEnergyStored() >= 400 + 100 * perkLevel;
|
var hasEnoughEnergy = energyStorage != null && energyStorage.getEnergyStored() >= 400 + 100 * perkLevel;
|
||||||
|
|
||||||
if (player.getCooldowns().isOnCooldown(stack.getItem())
|
if (player.getCooldowns().isOnCooldown(stack.getItem())
|
||||||
|| data.ammo() <= 0
|
|| data.ammo.get() <= 0
|
||||||
|| !hasEnoughEnergy
|
|| !hasEnoughEnergy
|
||||||
) return;
|
) return;
|
||||||
|
|
||||||
|
@ -256,7 +256,7 @@ public class TaserItem extends GunItem implements GeoItem, SpecialFireWeapon, En
|
||||||
PacketDistributor.sendToPlayer(serverPlayer, new ShootClientMessage(10));
|
PacketDistributor.sendToPlayer(serverPlayer, new ShootClientMessage(10));
|
||||||
}
|
}
|
||||||
|
|
||||||
data.setAmmo(data.ammo() - 1);
|
data.ammo.set(data.ammo.get() - 1);
|
||||||
data.tag().putBoolean("shoot", true);
|
data.tag().putBoolean("shoot", true);
|
||||||
energyStorage.extractEnergy(400 + 100 * perkLevel, false);
|
energyStorage.extractEnergy(400 + 100 * perkLevel, false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -209,13 +209,13 @@ public class ReforgingTableMenu extends AbstractContainerMenu {
|
||||||
}
|
}
|
||||||
var data = GunData.from(stack);
|
var data = GunData.from(stack);
|
||||||
|
|
||||||
double oldPoint = data.upgradePoint();
|
double oldPoint = data.upgradePoint.get();
|
||||||
int point = (int) oldPoint;
|
int point = (int) oldPoint;
|
||||||
int newPoint = this.upgradePoint.get();
|
int newPoint = this.upgradePoint.get();
|
||||||
int delta = newPoint - point;
|
int delta = newPoint - point;
|
||||||
|
|
||||||
if (delta != 0) {
|
if (delta != 0) {
|
||||||
data.setUpgradePoint(oldPoint + delta);
|
data.upgradePoint.set(oldPoint + delta);
|
||||||
data.save();
|
data.save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -292,7 +292,7 @@ public class ReforgingTableMenu extends AbstractContainerMenu {
|
||||||
int level = inputData.perk.getLevel(perkItem);
|
int level = inputData.perk.getLevel(perkItem);
|
||||||
|
|
||||||
if (level <= 0) {
|
if (level <= 0) {
|
||||||
this.upgradePoint.set((int) inputData.upgradePoint());
|
this.upgradePoint.set((int) inputData.upgradePoint.get());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -300,8 +300,8 @@ public class ReforgingTableMenu extends AbstractContainerMenu {
|
||||||
var outputData = GunData.from(output);
|
var outputData = GunData.from(output);
|
||||||
outputData.perk.remove(perkItem.getPerk());
|
outputData.perk.remove(perkItem.getPerk());
|
||||||
|
|
||||||
inputData.setUpgradePoint(Math.min(MAX_UPGRADE_POINT, level - 1 + inputData.upgradePoint()));
|
inputData.upgradePoint.set(Math.min(MAX_UPGRADE_POINT, level - 1 + inputData.upgradePoint.get()));
|
||||||
this.upgradePoint.set((int) inputData.upgradePoint());
|
this.upgradePoint.set((int) inputData.upgradePoint.get());
|
||||||
|
|
||||||
outputData.save();
|
outputData.save();
|
||||||
inputData.save();
|
inputData.save();
|
||||||
|
@ -336,7 +336,7 @@ public class ReforgingTableMenu extends AbstractContainerMenu {
|
||||||
if (!(stack.getItem() instanceof GunItem)) return;
|
if (!(stack.getItem() instanceof GunItem)) return;
|
||||||
var data = GunData.from(stack);
|
var data = GunData.from(stack);
|
||||||
|
|
||||||
int point = (int) data.upgradePoint();
|
int point = (int) data.upgradePoint.get();
|
||||||
this.upgradePoint.set(Mth.clamp(point, 0, MAX_UPGRADE_POINT));
|
this.upgradePoint.set(Mth.clamp(point, 0, MAX_UPGRADE_POINT));
|
||||||
|
|
||||||
for (var type : Perk.Type.values()) {
|
for (var type : Perk.Type.values()) {
|
||||||
|
|
|
@ -3,8 +3,8 @@ package com.atsuishio.superbwarfare.network.message.send;
|
||||||
import com.atsuishio.superbwarfare.Mod;
|
import com.atsuishio.superbwarfare.Mod;
|
||||||
import com.atsuishio.superbwarfare.init.ModSounds;
|
import com.atsuishio.superbwarfare.init.ModSounds;
|
||||||
import com.atsuishio.superbwarfare.init.ModTags;
|
import com.atsuishio.superbwarfare.init.ModTags;
|
||||||
import com.atsuishio.superbwarfare.item.gun.data.AttachmentType;
|
|
||||||
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
||||||
|
import com.atsuishio.superbwarfare.item.gun.data.value.AttachmentType;
|
||||||
import com.atsuishio.superbwarfare.tools.SoundTool;
|
import com.atsuishio.superbwarfare.tools.SoundTool;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import net.minecraft.network.codec.ByteBufCodecs;
|
import net.minecraft.network.codec.ByteBufCodecs;
|
||||||
|
|
|
@ -55,8 +55,8 @@ public record FireMessage(int msgType, double power, boolean zoom) implements Cu
|
||||||
var cap = player.getData(ModAttachments.PLAYER_VARIABLE).watch();
|
var cap = player.getData(ModAttachments.PLAYER_VARIABLE).watch();
|
||||||
|
|
||||||
if (type == 0) {
|
if (type == 0) {
|
||||||
if (data.reload.prepareTimer.get() == 0 && data.reloading() && data.ammo() > 0) {
|
if (data.reload.prepareTimer.get() == 0 && data.reloading() && data.ammo.get() > 0) {
|
||||||
data.setForceStop(true);
|
data.forceStop.set(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
cap.edit = false;
|
cap.edit = false;
|
||||||
|
@ -82,16 +82,16 @@ public record FireMessage(int msgType, double power, boolean zoom) implements Cu
|
||||||
if (!stack.is(ModTags.Items.GUN)) return;
|
if (!stack.is(ModTags.Items.GUN)) return;
|
||||||
var data = GunData.from(stack);
|
var data = GunData.from(stack);
|
||||||
|
|
||||||
if (data.bolt.defaultActionTime() > 0
|
if (data.defaultActionTime() > 0
|
||||||
&& data.ammo() > (stack.is(ModTags.Items.REVOLVER) ? -1 : 0)
|
&& data.ammo.get() > (stack.is(ModTags.Items.REVOLVER) ? -1 : 0)
|
||||||
&& data.bolt.actionTime() == 0
|
&& data.bolt.actionTimer.get() == 0
|
||||||
&& !(data.reload.normal()
|
&& !(data.reload.normal()
|
||||||
|| data.reload.empty())
|
|| data.reload.empty())
|
||||||
&& !data.reloading()
|
&& !data.reloading()
|
||||||
&& !data.charging()
|
&& !data.charging()
|
||||||
) {
|
) {
|
||||||
if (!player.getCooldowns().isOnCooldown(stack.getItem()) && data.bolt.needed()) {
|
if (!player.getCooldowns().isOnCooldown(stack.getItem()) && data.bolt.needed.get()) {
|
||||||
data.bolt.setActionTime(data.bolt.defaultActionTime() + 1);
|
data.bolt.actionTimer.set(data.defaultActionTime() + 1);
|
||||||
GunEventHandler.playGunBoltSounds(player);
|
GunEventHandler.playGunBoltSounds(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,20 +35,20 @@ public record FireModeMessage(int msgType) implements CustomPacketPayload {
|
||||||
if (stack.getItem() instanceof GunItem gunItem) {
|
if (stack.getItem() instanceof GunItem gunItem) {
|
||||||
var data = GunData.from(stack);
|
var data = GunData.from(stack);
|
||||||
var tag = data.tag();
|
var tag = data.tag();
|
||||||
int fireMode = data.fireMode();
|
int fireMode = data.fireMode.get();
|
||||||
|
|
||||||
int mode = gunItem.getAvailableFireModes();
|
int mode = gunItem.getAvailableFireModes();
|
||||||
mode &= 0b111;
|
mode &= 0b111;
|
||||||
|
|
||||||
if (fireMode == 0) {
|
if (fireMode == 0) {
|
||||||
if ((mode & 2) != 0) {
|
if ((mode & 2) != 0) {
|
||||||
data.setFireMode(1);
|
data.fireMode.set(1);
|
||||||
playChangeModeSound(player);
|
playChangeModeSound(player);
|
||||||
data.save();
|
data.save();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ((mode & 4) != 0) {
|
if ((mode & 4) != 0) {
|
||||||
data.setFireMode(2);
|
data.fireMode.set(2);
|
||||||
playChangeModeSound(player);
|
playChangeModeSound(player);
|
||||||
data.save();
|
data.save();
|
||||||
return;
|
return;
|
||||||
|
@ -57,13 +57,13 @@ public record FireModeMessage(int msgType) implements CustomPacketPayload {
|
||||||
|
|
||||||
if (fireMode == 1) {
|
if (fireMode == 1) {
|
||||||
if ((mode & 4) != 0) {
|
if ((mode & 4) != 0) {
|
||||||
data.setFireMode(2);
|
data.fireMode.set(2);
|
||||||
playChangeModeSound(player);
|
playChangeModeSound(player);
|
||||||
data.save();
|
data.save();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ((mode & 1) != 0) {
|
if ((mode & 1) != 0) {
|
||||||
data.setFireMode(0);
|
data.fireMode.set(0);
|
||||||
playChangeModeSound(player);
|
playChangeModeSound(player);
|
||||||
data.save();
|
data.save();
|
||||||
return;
|
return;
|
||||||
|
@ -72,13 +72,13 @@ public record FireModeMessage(int msgType) implements CustomPacketPayload {
|
||||||
|
|
||||||
if (fireMode == 2) {
|
if (fireMode == 2) {
|
||||||
if ((mode & 1) != 0) {
|
if ((mode & 1) != 0) {
|
||||||
data.setFireMode(0);
|
data.fireMode.set(0);
|
||||||
playChangeModeSound(player);
|
playChangeModeSound(player);
|
||||||
data.save();
|
data.save();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ((mode & 2) != 0) {
|
if ((mode & 2) != 0) {
|
||||||
data.setFireMode(1);
|
data.fireMode.set(1);
|
||||||
playChangeModeSound(player);
|
playChangeModeSound(player);
|
||||||
data.save();
|
data.save();
|
||||||
return;
|
return;
|
||||||
|
@ -109,10 +109,10 @@ public record FireModeMessage(int msgType) implements CustomPacketPayload {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getItem() == ModItems.TRACHELIUM.get() && !data.bolt.needed()) {
|
if (stack.getItem() == ModItems.TRACHELIUM.get() && !data.bolt.needed.get()) {
|
||||||
data.setDA(!data.DA());
|
data.DA.set(!data.DA.get());
|
||||||
if (!data.canImmediatelyShoot()) {
|
if (!data.canImmediatelyShoot.get()) {
|
||||||
data.bolt.markNeeded();
|
data.bolt.needed.set(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,11 +44,11 @@ public record ReloadMessage(int msgType) implements CustomPacketPayload {
|
||||||
&& !data.charging()
|
&& !data.charging()
|
||||||
&& !data.reloading()
|
&& !data.reloading()
|
||||||
&& data.reload.time() == 0
|
&& data.reload.time() == 0
|
||||||
&& data.bolt.actionTime() == 0
|
&& data.bolt.actionTimer.get() == 0
|
||||||
) {
|
) {
|
||||||
boolean canSingleReload = gunItem.isIterativeReload(stack);
|
boolean canSingleReload = gunItem.isIterativeReload(stack);
|
||||||
boolean canReload = gunItem.isMagazineReload(stack) && !gunItem.isClipReload(stack);
|
boolean canReload = gunItem.isMagazineReload(stack) && !gunItem.isClipReload(stack);
|
||||||
boolean clipLoad = data.ammo() == 0 && gunItem.isClipReload(stack);
|
boolean clipLoad = data.ammo.get() == 0 && gunItem.isClipReload(stack);
|
||||||
|
|
||||||
// 检查备弹
|
// 检查备弹
|
||||||
boolean hasCreativeAmmoBox = player.getInventory().hasAnyMatching(item -> item.is(ModItems.CREATIVE_AMMO_BOX.get()));
|
boolean hasCreativeAmmoBox = player.getInventory().hasAnyMatching(item -> item.is(ModItems.CREATIVE_AMMO_BOX.get()));
|
||||||
|
@ -64,9 +64,9 @@ public record ReloadMessage(int msgType) implements CustomPacketPayload {
|
||||||
return;
|
return;
|
||||||
} else if (stack.is(ModTags.Items.USE_HEAVY_AMMO) && cap.heavyAmmo == 0) {
|
} else if (stack.is(ModTags.Items.USE_HEAVY_AMMO) && cap.heavyAmmo == 0) {
|
||||||
return;
|
return;
|
||||||
} else if (stack.getItem() == ModItems.TASER.get() && data.maxAmmo() == 0) {
|
} else if (stack.getItem() == ModItems.TASER.get() && data.maxAmmo.get() == 0) {
|
||||||
return;
|
return;
|
||||||
} else if (stack.is(ModTags.Items.LAUNCHER) && data.maxAmmo() == 0) {
|
} else if (stack.is(ModTags.Items.LAUNCHER) && data.maxAmmo.get() == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -76,13 +76,13 @@ public record ReloadMessage(int msgType) implements CustomPacketPayload {
|
||||||
var extra = (gunItem.isOpenBolt(stack) && gunItem.hasBulletInBarrel(stack)) ? 1 : 0;
|
var extra = (gunItem.isOpenBolt(stack) && gunItem.hasBulletInBarrel(stack)) ? 1 : 0;
|
||||||
var maxAmmo = magazine + extra;
|
var maxAmmo = magazine + extra;
|
||||||
|
|
||||||
if (data.ammo() < maxAmmo) {
|
if (data.ammo.get() < maxAmmo) {
|
||||||
data.reload.reloadStarter.markStart();
|
data.reload.reloadStarter.markStart();
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (canSingleReload && data.ammo() < data.magazine()) {
|
if (canSingleReload && data.ammo.get() < data.magazine()) {
|
||||||
data.reload.singleReloadStarter.markStart();
|
data.reload.singleReloadStarter.markStart();
|
||||||
}
|
}
|
||||||
data.save();
|
data.save();
|
||||||
|
|
|
@ -47,25 +47,25 @@ public record ShootMessage(double spread, boolean zoom) implements CustomPacketP
|
||||||
if (stack.is(ModTags.Items.NORMAL_GUN)) {
|
if (stack.is(ModTags.Items.NORMAL_GUN)) {
|
||||||
int projectileAmount = data.projectileAmount();
|
int projectileAmount = data.projectileAmount();
|
||||||
|
|
||||||
if (data.ammo() > 0) {
|
if (data.ammo.get() > 0) {
|
||||||
// 空仓挂机
|
// 空仓挂机
|
||||||
if (data.ammo() == 1) {
|
if (data.ammo.get() == 1) {
|
||||||
GunsTool.setGunBooleanTag(tag, "HoldOpen", true);
|
GunsTool.setGunBooleanTag(tag, "HoldOpen", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.is(ModTags.Items.REVOLVER)) {
|
if (stack.is(ModTags.Items.REVOLVER)) {
|
||||||
data.setCanImmediatelyShoot(false);
|
data.canImmediatelyShoot.set(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 判断是否为栓动武器(BoltActionTime > 0),并在开火后给一个需要上膛的状态
|
// 判断是否为栓动武器(BoltActionTime > 0),并在开火后给一个需要上膛的状态
|
||||||
if (data.bolt.defaultActionTime() > 0 && data.ammo() > (stack.is(ModTags.Items.REVOLVER) ? 0 : 1)) {
|
if (data.defaultActionTime() > 0 && data.ammo.get() > (stack.is(ModTags.Items.REVOLVER) ? 0 : 1)) {
|
||||||
data.bolt.markNeeded();
|
data.bolt.needed.set(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
data.setAmmo(data.ammo() - 1);
|
data.ammo.set(data.ammo.get() - 1);
|
||||||
data.setIsEmpty(true);
|
data.isEmpty.set(true);
|
||||||
|
|
||||||
if (stack.getItem() == ModItems.M_60.get() && data.ammo() <= 5) {
|
if (stack.getItem() == ModItems.M_60.get() && data.ammo.get() <= 5) {
|
||||||
GunsTool.setGunBooleanTag(tag, "HideBulletChain", true);
|
GunsTool.setGunBooleanTag(tag, "HideBulletChain", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ import com.atsuishio.superbwarfare.Mod;
|
||||||
import com.atsuishio.superbwarfare.init.ModAttachments;
|
import com.atsuishio.superbwarfare.init.ModAttachments;
|
||||||
import com.atsuishio.superbwarfare.init.ModTags;
|
import com.atsuishio.superbwarfare.init.ModTags;
|
||||||
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
import com.atsuishio.superbwarfare.item.gun.data.GunData;
|
||||||
import com.atsuishio.superbwarfare.item.gun.data.ReloadState;
|
import com.atsuishio.superbwarfare.item.gun.data.value.ReloadState;
|
||||||
import com.atsuishio.superbwarfare.network.message.receive.GunsDataMessage;
|
import com.atsuishio.superbwarfare.network.message.receive.GunsDataMessage;
|
||||||
import com.google.gson.stream.JsonReader;
|
import com.google.gson.stream.JsonReader;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
|
@ -80,12 +80,12 @@ public class GunsTool {
|
||||||
|
|
||||||
public static void reload(Player player, ItemStack stack, GunData data, AmmoType type, boolean extraOne) {
|
public static void reload(Player player, ItemStack stack, GunData data, AmmoType type, boolean extraOne) {
|
||||||
int mag = data.magazine();
|
int mag = data.magazine();
|
||||||
int ammo = data.ammo();
|
int ammo = data.ammo.get();
|
||||||
int ammoToAdd = mag - ammo + (extraOne ? 1 : 0);
|
int ammoToAdd = mag - ammo + (extraOne ? 1 : 0);
|
||||||
|
|
||||||
// 空仓换弹的栓动武器应该在换弹后取消待上膛标记
|
// 空仓换弹的栓动武器应该在换弹后取消待上膛标记
|
||||||
if (ammo == 0 && data.bolt.defaultActionTime() > 0 && !stack.is(ModTags.Items.REVOLVER)) {
|
if (ammo == 0 && data.defaultActionTime() > 0 && !stack.is(ModTags.Items.REVOLVER)) {
|
||||||
data.bolt.markNeedless();
|
data.bolt.needed.set(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
var capability = player.getData(ModAttachments.PLAYER_VARIABLE).watch();
|
var capability = player.getData(ModAttachments.PLAYER_VARIABLE).watch();
|
||||||
|
@ -99,7 +99,7 @@ public class GunsTool {
|
||||||
|
|
||||||
int needToAdd = ammo + Math.min(ammoToAdd, playerAmmo);
|
int needToAdd = ammo + Math.min(ammoToAdd, playerAmmo);
|
||||||
|
|
||||||
data.setAmmo(needToAdd);
|
data.ammo.set(needToAdd);
|
||||||
data.reload.setState(ReloadState.NOT_RELOADING);
|
data.reload.setState(ReloadState.NOT_RELOADING);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue