将部分变量类型修改为int
This commit is contained in:
parent
08b691b932
commit
8d6bbc00b9
56 changed files with 456 additions and 455 deletions
|
@ -51,7 +51,7 @@ public class BocekItemModel extends GeoModel<BocekItem> {
|
||||||
arrow.setScaleZ(0);
|
arrow.setScaleZ(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("maxammo") == 0) {
|
if (stack.getOrCreateTag().getInt("maxammo") == 0) {
|
||||||
jian.setScaleX(0);
|
jian.setScaleX(0);
|
||||||
jian.setScaleY(0);
|
jian.setScaleY(0);
|
||||||
jian.setScaleZ(0);
|
jian.setScaleZ(0);
|
||||||
|
|
|
@ -164,7 +164,7 @@ public class DevotionItemModel extends GeoModel<Devotion> {
|
||||||
CoreGeoBone n55 = getAnimationProcessor().getBone("55");
|
CoreGeoBone n55 = getAnimationProcessor().getBone("55");
|
||||||
CoreGeoBone n56 = getAnimationProcessor().getBone("56");
|
CoreGeoBone n56 = getAnimationProcessor().getBone("56");
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("ammo") == 0) {
|
if (stack.getOrCreateTag().getInt("ammo") == 0) {
|
||||||
n0.setScaleX(1);
|
n0.setScaleX(1);
|
||||||
n0.setScaleY(1);
|
n0.setScaleY(1);
|
||||||
} else {
|
} else {
|
||||||
|
@ -172,7 +172,7 @@ public class DevotionItemModel extends GeoModel<Devotion> {
|
||||||
n0.setScaleY(0);
|
n0.setScaleY(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("ammo") == 1) {
|
if (stack.getOrCreateTag().getInt("ammo") == 1) {
|
||||||
n1.setScaleX(1);
|
n1.setScaleX(1);
|
||||||
n1.setScaleY(1);
|
n1.setScaleY(1);
|
||||||
} else {
|
} else {
|
||||||
|
@ -181,7 +181,7 @@ public class DevotionItemModel extends GeoModel<Devotion> {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("ammo") == 2) {
|
if (stack.getOrCreateTag().getInt("ammo") == 2) {
|
||||||
n2.setScaleX(1);
|
n2.setScaleX(1);
|
||||||
n2.setScaleY(1);
|
n2.setScaleY(1);
|
||||||
} else {
|
} else {
|
||||||
|
@ -189,7 +189,7 @@ public class DevotionItemModel extends GeoModel<Devotion> {
|
||||||
n2.setScaleY(0);
|
n2.setScaleY(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("ammo") == 3) {
|
if (stack.getOrCreateTag().getInt("ammo") == 3) {
|
||||||
n3.setScaleX(1);
|
n3.setScaleX(1);
|
||||||
n3.setScaleY(1);
|
n3.setScaleY(1);
|
||||||
} else {
|
} else {
|
||||||
|
@ -197,7 +197,7 @@ public class DevotionItemModel extends GeoModel<Devotion> {
|
||||||
n3.setScaleY(0);
|
n3.setScaleY(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("ammo") == 4) {
|
if (stack.getOrCreateTag().getInt("ammo") == 4) {
|
||||||
n4.setScaleX(1);
|
n4.setScaleX(1);
|
||||||
n4.setScaleY(1);
|
n4.setScaleY(1);
|
||||||
} else {
|
} else {
|
||||||
|
@ -205,7 +205,7 @@ public class DevotionItemModel extends GeoModel<Devotion> {
|
||||||
n4.setScaleY(0);
|
n4.setScaleY(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("ammo") == 5) {
|
if (stack.getOrCreateTag().getInt("ammo") == 5) {
|
||||||
n5.setScaleX(1);
|
n5.setScaleX(1);
|
||||||
n5.setScaleY(1);
|
n5.setScaleY(1);
|
||||||
} else {
|
} else {
|
||||||
|
@ -213,7 +213,7 @@ public class DevotionItemModel extends GeoModel<Devotion> {
|
||||||
n5.setScaleY(0);
|
n5.setScaleY(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("ammo") == 6) {
|
if (stack.getOrCreateTag().getInt("ammo") == 6) {
|
||||||
n6.setScaleX(1);
|
n6.setScaleX(1);
|
||||||
n6.setScaleY(1);
|
n6.setScaleY(1);
|
||||||
} else {
|
} else {
|
||||||
|
@ -221,7 +221,7 @@ public class DevotionItemModel extends GeoModel<Devotion> {
|
||||||
n6.setScaleY(0);
|
n6.setScaleY(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("ammo") == 7) {
|
if (stack.getOrCreateTag().getInt("ammo") == 7) {
|
||||||
n7.setScaleX(1);
|
n7.setScaleX(1);
|
||||||
n7.setScaleY(1);
|
n7.setScaleY(1);
|
||||||
} else {
|
} else {
|
||||||
|
@ -229,7 +229,7 @@ public class DevotionItemModel extends GeoModel<Devotion> {
|
||||||
n7.setScaleY(0);
|
n7.setScaleY(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("ammo") == 8) {
|
if (stack.getOrCreateTag().getInt("ammo") == 8) {
|
||||||
n8.setScaleX(1);
|
n8.setScaleX(1);
|
||||||
n8.setScaleY(1);
|
n8.setScaleY(1);
|
||||||
} else {
|
} else {
|
||||||
|
@ -237,7 +237,7 @@ public class DevotionItemModel extends GeoModel<Devotion> {
|
||||||
n8.setScaleY(0);
|
n8.setScaleY(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("ammo") == 9) {
|
if (stack.getOrCreateTag().getInt("ammo") == 9) {
|
||||||
n9.setScaleX(1);
|
n9.setScaleX(1);
|
||||||
n9.setScaleY(1);
|
n9.setScaleY(1);
|
||||||
} else {
|
} else {
|
||||||
|
@ -245,7 +245,7 @@ public class DevotionItemModel extends GeoModel<Devotion> {
|
||||||
n9.setScaleY(0);
|
n9.setScaleY(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("ammo") == 10) {
|
if (stack.getOrCreateTag().getInt("ammo") == 10) {
|
||||||
n10.setScaleX(1);
|
n10.setScaleX(1);
|
||||||
n10.setScaleY(1);
|
n10.setScaleY(1);
|
||||||
} else {
|
} else {
|
||||||
|
@ -253,7 +253,7 @@ public class DevotionItemModel extends GeoModel<Devotion> {
|
||||||
n10.setScaleY(0);
|
n10.setScaleY(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("ammo") == 11) {
|
if (stack.getOrCreateTag().getInt("ammo") == 11) {
|
||||||
n11.setScaleX(1);
|
n11.setScaleX(1);
|
||||||
n11.setScaleY(1);
|
n11.setScaleY(1);
|
||||||
} else {
|
} else {
|
||||||
|
@ -262,7 +262,7 @@ public class DevotionItemModel extends GeoModel<Devotion> {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("ammo") == 12) {
|
if (stack.getOrCreateTag().getInt("ammo") == 12) {
|
||||||
n12.setScaleX(1);
|
n12.setScaleX(1);
|
||||||
n12.setScaleY(1);
|
n12.setScaleY(1);
|
||||||
} else {
|
} else {
|
||||||
|
@ -270,7 +270,7 @@ public class DevotionItemModel extends GeoModel<Devotion> {
|
||||||
n12.setScaleY(0);
|
n12.setScaleY(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("ammo") == 13) {
|
if (stack.getOrCreateTag().getInt("ammo") == 13) {
|
||||||
n13.setScaleX(1);
|
n13.setScaleX(1);
|
||||||
n13.setScaleY(1);
|
n13.setScaleY(1);
|
||||||
} else {
|
} else {
|
||||||
|
@ -278,7 +278,7 @@ public class DevotionItemModel extends GeoModel<Devotion> {
|
||||||
n13.setScaleY(0);
|
n13.setScaleY(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("ammo") == 14) {
|
if (stack.getOrCreateTag().getInt("ammo") == 14) {
|
||||||
n14.setScaleX(1);
|
n14.setScaleX(1);
|
||||||
n14.setScaleY(1);
|
n14.setScaleY(1);
|
||||||
} else {
|
} else {
|
||||||
|
@ -286,7 +286,7 @@ public class DevotionItemModel extends GeoModel<Devotion> {
|
||||||
n14.setScaleY(0);
|
n14.setScaleY(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("ammo") == 15) {
|
if (stack.getOrCreateTag().getInt("ammo") == 15) {
|
||||||
n15.setScaleX(1);
|
n15.setScaleX(1);
|
||||||
n15.setScaleY(1);
|
n15.setScaleY(1);
|
||||||
} else {
|
} else {
|
||||||
|
@ -294,7 +294,7 @@ public class DevotionItemModel extends GeoModel<Devotion> {
|
||||||
n15.setScaleY(0);
|
n15.setScaleY(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("ammo") == 16) {
|
if (stack.getOrCreateTag().getInt("ammo") == 16) {
|
||||||
n16.setScaleX(1);
|
n16.setScaleX(1);
|
||||||
n16.setScaleY(1);
|
n16.setScaleY(1);
|
||||||
} else {
|
} else {
|
||||||
|
@ -302,7 +302,7 @@ public class DevotionItemModel extends GeoModel<Devotion> {
|
||||||
n16.setScaleY(0);
|
n16.setScaleY(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("ammo") == 17) {
|
if (stack.getOrCreateTag().getInt("ammo") == 17) {
|
||||||
n17.setScaleX(1);
|
n17.setScaleX(1);
|
||||||
n17.setScaleY(1);
|
n17.setScaleY(1);
|
||||||
} else {
|
} else {
|
||||||
|
@ -310,7 +310,7 @@ public class DevotionItemModel extends GeoModel<Devotion> {
|
||||||
n17.setScaleY(0);
|
n17.setScaleY(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("ammo") == 18) {
|
if (stack.getOrCreateTag().getInt("ammo") == 18) {
|
||||||
n18.setScaleX(1);
|
n18.setScaleX(1);
|
||||||
n18.setScaleY(1);
|
n18.setScaleY(1);
|
||||||
} else {
|
} else {
|
||||||
|
@ -318,7 +318,7 @@ public class DevotionItemModel extends GeoModel<Devotion> {
|
||||||
n18.setScaleY(0);
|
n18.setScaleY(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("ammo") == 19) {
|
if (stack.getOrCreateTag().getInt("ammo") == 19) {
|
||||||
n19.setScaleX(1);
|
n19.setScaleX(1);
|
||||||
n19.setScaleY(1);
|
n19.setScaleY(1);
|
||||||
} else {
|
} else {
|
||||||
|
@ -326,7 +326,7 @@ public class DevotionItemModel extends GeoModel<Devotion> {
|
||||||
n19.setScaleY(0);
|
n19.setScaleY(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("ammo") == 20) {
|
if (stack.getOrCreateTag().getInt("ammo") == 20) {
|
||||||
n20.setScaleX(1);
|
n20.setScaleX(1);
|
||||||
n20.setScaleY(1);
|
n20.setScaleY(1);
|
||||||
} else {
|
} else {
|
||||||
|
@ -334,7 +334,7 @@ public class DevotionItemModel extends GeoModel<Devotion> {
|
||||||
n20.setScaleY(0);
|
n20.setScaleY(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("ammo") == 21) {
|
if (stack.getOrCreateTag().getInt("ammo") == 21) {
|
||||||
n21.setScaleX(1);
|
n21.setScaleX(1);
|
||||||
n21.setScaleY(1);
|
n21.setScaleY(1);
|
||||||
} else {
|
} else {
|
||||||
|
@ -343,7 +343,7 @@ public class DevotionItemModel extends GeoModel<Devotion> {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("ammo") == 22) {
|
if (stack.getOrCreateTag().getInt("ammo") == 22) {
|
||||||
n22.setScaleX(1);
|
n22.setScaleX(1);
|
||||||
n22.setScaleY(1);
|
n22.setScaleY(1);
|
||||||
} else {
|
} else {
|
||||||
|
@ -351,7 +351,7 @@ public class DevotionItemModel extends GeoModel<Devotion> {
|
||||||
n22.setScaleY(0);
|
n22.setScaleY(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("ammo") == 23) {
|
if (stack.getOrCreateTag().getInt("ammo") == 23) {
|
||||||
n23.setScaleX(1);
|
n23.setScaleX(1);
|
||||||
n23.setScaleY(1);
|
n23.setScaleY(1);
|
||||||
} else {
|
} else {
|
||||||
|
@ -359,7 +359,7 @@ public class DevotionItemModel extends GeoModel<Devotion> {
|
||||||
n23.setScaleY(0);
|
n23.setScaleY(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("ammo") == 24) {
|
if (stack.getOrCreateTag().getInt("ammo") == 24) {
|
||||||
n24.setScaleX(1);
|
n24.setScaleX(1);
|
||||||
n24.setScaleY(1);
|
n24.setScaleY(1);
|
||||||
} else {
|
} else {
|
||||||
|
@ -367,7 +367,7 @@ public class DevotionItemModel extends GeoModel<Devotion> {
|
||||||
n24.setScaleY(0);
|
n24.setScaleY(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("ammo") == 25) {
|
if (stack.getOrCreateTag().getInt("ammo") == 25) {
|
||||||
n25.setScaleX(1);
|
n25.setScaleX(1);
|
||||||
n25.setScaleY(1);
|
n25.setScaleY(1);
|
||||||
} else {
|
} else {
|
||||||
|
@ -375,7 +375,7 @@ public class DevotionItemModel extends GeoModel<Devotion> {
|
||||||
n25.setScaleY(0);
|
n25.setScaleY(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("ammo") == 26) {
|
if (stack.getOrCreateTag().getInt("ammo") == 26) {
|
||||||
n26.setScaleX(1);
|
n26.setScaleX(1);
|
||||||
n26.setScaleY(1);
|
n26.setScaleY(1);
|
||||||
} else {
|
} else {
|
||||||
|
@ -383,7 +383,7 @@ public class DevotionItemModel extends GeoModel<Devotion> {
|
||||||
n26.setScaleY(0);
|
n26.setScaleY(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("ammo") == 27) {
|
if (stack.getOrCreateTag().getInt("ammo") == 27) {
|
||||||
n27.setScaleX(1);
|
n27.setScaleX(1);
|
||||||
n27.setScaleY(1);
|
n27.setScaleY(1);
|
||||||
} else {
|
} else {
|
||||||
|
@ -391,7 +391,7 @@ public class DevotionItemModel extends GeoModel<Devotion> {
|
||||||
n27.setScaleY(0);
|
n27.setScaleY(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("ammo") == 28) {
|
if (stack.getOrCreateTag().getInt("ammo") == 28) {
|
||||||
n28.setScaleX(1);
|
n28.setScaleX(1);
|
||||||
n28.setScaleY(1);
|
n28.setScaleY(1);
|
||||||
} else {
|
} else {
|
||||||
|
@ -399,7 +399,7 @@ public class DevotionItemModel extends GeoModel<Devotion> {
|
||||||
n28.setScaleY(0);
|
n28.setScaleY(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("ammo") == 29) {
|
if (stack.getOrCreateTag().getInt("ammo") == 29) {
|
||||||
n29.setScaleX(1);
|
n29.setScaleX(1);
|
||||||
n29.setScaleY(1);
|
n29.setScaleY(1);
|
||||||
} else {
|
} else {
|
||||||
|
@ -407,7 +407,7 @@ public class DevotionItemModel extends GeoModel<Devotion> {
|
||||||
n29.setScaleY(0);
|
n29.setScaleY(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("ammo") == 30) {
|
if (stack.getOrCreateTag().getInt("ammo") == 30) {
|
||||||
n30.setScaleX(1);
|
n30.setScaleX(1);
|
||||||
n30.setScaleY(1);
|
n30.setScaleY(1);
|
||||||
} else {
|
} else {
|
||||||
|
@ -415,7 +415,7 @@ public class DevotionItemModel extends GeoModel<Devotion> {
|
||||||
n30.setScaleY(0);
|
n30.setScaleY(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("ammo") == 31) {
|
if (stack.getOrCreateTag().getInt("ammo") == 31) {
|
||||||
n31.setScaleX(1);
|
n31.setScaleX(1);
|
||||||
n31.setScaleY(1);
|
n31.setScaleY(1);
|
||||||
} else {
|
} else {
|
||||||
|
@ -424,7 +424,7 @@ public class DevotionItemModel extends GeoModel<Devotion> {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("ammo") == 32) {
|
if (stack.getOrCreateTag().getInt("ammo") == 32) {
|
||||||
n32.setScaleX(1);
|
n32.setScaleX(1);
|
||||||
n32.setScaleY(1);
|
n32.setScaleY(1);
|
||||||
} else {
|
} else {
|
||||||
|
@ -432,7 +432,7 @@ public class DevotionItemModel extends GeoModel<Devotion> {
|
||||||
n32.setScaleY(0);
|
n32.setScaleY(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("ammo") == 33) {
|
if (stack.getOrCreateTag().getInt("ammo") == 33) {
|
||||||
n33.setScaleX(1);
|
n33.setScaleX(1);
|
||||||
n33.setScaleY(1);
|
n33.setScaleY(1);
|
||||||
} else {
|
} else {
|
||||||
|
@ -440,7 +440,7 @@ public class DevotionItemModel extends GeoModel<Devotion> {
|
||||||
n33.setScaleY(0);
|
n33.setScaleY(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("ammo") == 34) {
|
if (stack.getOrCreateTag().getInt("ammo") == 34) {
|
||||||
n34.setScaleX(1);
|
n34.setScaleX(1);
|
||||||
n34.setScaleY(1);
|
n34.setScaleY(1);
|
||||||
} else {
|
} else {
|
||||||
|
@ -448,7 +448,7 @@ public class DevotionItemModel extends GeoModel<Devotion> {
|
||||||
n34.setScaleY(0);
|
n34.setScaleY(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("ammo") == 35) {
|
if (stack.getOrCreateTag().getInt("ammo") == 35) {
|
||||||
n35.setScaleX(1);
|
n35.setScaleX(1);
|
||||||
n35.setScaleY(1);
|
n35.setScaleY(1);
|
||||||
} else {
|
} else {
|
||||||
|
@ -456,7 +456,7 @@ public class DevotionItemModel extends GeoModel<Devotion> {
|
||||||
n35.setScaleY(0);
|
n35.setScaleY(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("ammo") == 36) {
|
if (stack.getOrCreateTag().getInt("ammo") == 36) {
|
||||||
n36.setScaleX(1);
|
n36.setScaleX(1);
|
||||||
n36.setScaleY(1);
|
n36.setScaleY(1);
|
||||||
} else {
|
} else {
|
||||||
|
@ -464,7 +464,7 @@ public class DevotionItemModel extends GeoModel<Devotion> {
|
||||||
n36.setScaleY(0);
|
n36.setScaleY(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("ammo") == 37) {
|
if (stack.getOrCreateTag().getInt("ammo") == 37) {
|
||||||
n37.setScaleX(1);
|
n37.setScaleX(1);
|
||||||
n37.setScaleY(1);
|
n37.setScaleY(1);
|
||||||
} else {
|
} else {
|
||||||
|
@ -472,7 +472,7 @@ public class DevotionItemModel extends GeoModel<Devotion> {
|
||||||
n37.setScaleY(0);
|
n37.setScaleY(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("ammo") == 38) {
|
if (stack.getOrCreateTag().getInt("ammo") == 38) {
|
||||||
n38.setScaleX(1);
|
n38.setScaleX(1);
|
||||||
n38.setScaleY(1);
|
n38.setScaleY(1);
|
||||||
} else {
|
} else {
|
||||||
|
@ -480,7 +480,7 @@ public class DevotionItemModel extends GeoModel<Devotion> {
|
||||||
n38.setScaleY(0);
|
n38.setScaleY(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("ammo") == 39) {
|
if (stack.getOrCreateTag().getInt("ammo") == 39) {
|
||||||
n39.setScaleX(1);
|
n39.setScaleX(1);
|
||||||
n39.setScaleY(1);
|
n39.setScaleY(1);
|
||||||
} else {
|
} else {
|
||||||
|
@ -488,7 +488,7 @@ public class DevotionItemModel extends GeoModel<Devotion> {
|
||||||
n39.setScaleY(0);
|
n39.setScaleY(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("ammo") == 40) {
|
if (stack.getOrCreateTag().getInt("ammo") == 40) {
|
||||||
n40.setScaleX(1);
|
n40.setScaleX(1);
|
||||||
n40.setScaleY(1);
|
n40.setScaleY(1);
|
||||||
} else {
|
} else {
|
||||||
|
@ -496,7 +496,7 @@ public class DevotionItemModel extends GeoModel<Devotion> {
|
||||||
n40.setScaleY(0);
|
n40.setScaleY(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("ammo") == 41) {
|
if (stack.getOrCreateTag().getInt("ammo") == 41) {
|
||||||
n41.setScaleX(1);
|
n41.setScaleX(1);
|
||||||
n41.setScaleY(1);
|
n41.setScaleY(1);
|
||||||
} else {
|
} else {
|
||||||
|
@ -505,7 +505,7 @@ public class DevotionItemModel extends GeoModel<Devotion> {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("ammo") == 42) {
|
if (stack.getOrCreateTag().getInt("ammo") == 42) {
|
||||||
n42.setScaleX(1);
|
n42.setScaleX(1);
|
||||||
n42.setScaleY(1);
|
n42.setScaleY(1);
|
||||||
} else {
|
} else {
|
||||||
|
@ -513,7 +513,7 @@ public class DevotionItemModel extends GeoModel<Devotion> {
|
||||||
n42.setScaleY(0);
|
n42.setScaleY(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("ammo") == 43) {
|
if (stack.getOrCreateTag().getInt("ammo") == 43) {
|
||||||
n43.setScaleX(1);
|
n43.setScaleX(1);
|
||||||
n43.setScaleY(1);
|
n43.setScaleY(1);
|
||||||
} else {
|
} else {
|
||||||
|
@ -521,7 +521,7 @@ public class DevotionItemModel extends GeoModel<Devotion> {
|
||||||
n43.setScaleY(0);
|
n43.setScaleY(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("ammo") == 44) {
|
if (stack.getOrCreateTag().getInt("ammo") == 44) {
|
||||||
n44.setScaleX(1);
|
n44.setScaleX(1);
|
||||||
n44.setScaleY(1);
|
n44.setScaleY(1);
|
||||||
} else {
|
} else {
|
||||||
|
@ -529,7 +529,7 @@ public class DevotionItemModel extends GeoModel<Devotion> {
|
||||||
n44.setScaleY(0);
|
n44.setScaleY(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("ammo") == 45) {
|
if (stack.getOrCreateTag().getInt("ammo") == 45) {
|
||||||
n45.setScaleX(1);
|
n45.setScaleX(1);
|
||||||
n45.setScaleY(1);
|
n45.setScaleY(1);
|
||||||
} else {
|
} else {
|
||||||
|
@ -537,7 +537,7 @@ public class DevotionItemModel extends GeoModel<Devotion> {
|
||||||
n45.setScaleY(0);
|
n45.setScaleY(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("ammo") == 46) {
|
if (stack.getOrCreateTag().getInt("ammo") == 46) {
|
||||||
n46.setScaleX(1);
|
n46.setScaleX(1);
|
||||||
n46.setScaleY(1);
|
n46.setScaleY(1);
|
||||||
} else {
|
} else {
|
||||||
|
@ -545,7 +545,7 @@ public class DevotionItemModel extends GeoModel<Devotion> {
|
||||||
n46.setScaleY(0);
|
n46.setScaleY(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("ammo") == 47) {
|
if (stack.getOrCreateTag().getInt("ammo") == 47) {
|
||||||
n47.setScaleX(1);
|
n47.setScaleX(1);
|
||||||
n47.setScaleY(1);
|
n47.setScaleY(1);
|
||||||
} else {
|
} else {
|
||||||
|
@ -553,7 +553,7 @@ public class DevotionItemModel extends GeoModel<Devotion> {
|
||||||
n47.setScaleY(0);
|
n47.setScaleY(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("ammo") == 48) {
|
if (stack.getOrCreateTag().getInt("ammo") == 48) {
|
||||||
n48.setScaleX(1);
|
n48.setScaleX(1);
|
||||||
n48.setScaleY(1);
|
n48.setScaleY(1);
|
||||||
} else {
|
} else {
|
||||||
|
@ -561,7 +561,7 @@ public class DevotionItemModel extends GeoModel<Devotion> {
|
||||||
n48.setScaleY(0);
|
n48.setScaleY(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("ammo") == 49) {
|
if (stack.getOrCreateTag().getInt("ammo") == 49) {
|
||||||
n49.setScaleX(1);
|
n49.setScaleX(1);
|
||||||
n49.setScaleY(1);
|
n49.setScaleY(1);
|
||||||
} else {
|
} else {
|
||||||
|
@ -569,7 +569,7 @@ public class DevotionItemModel extends GeoModel<Devotion> {
|
||||||
n49.setScaleY(0);
|
n49.setScaleY(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("ammo") == 50) {
|
if (stack.getOrCreateTag().getInt("ammo") == 50) {
|
||||||
n50.setScaleX(1);
|
n50.setScaleX(1);
|
||||||
n50.setScaleY(1);
|
n50.setScaleY(1);
|
||||||
} else {
|
} else {
|
||||||
|
@ -577,7 +577,7 @@ public class DevotionItemModel extends GeoModel<Devotion> {
|
||||||
n50.setScaleY(0);
|
n50.setScaleY(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("ammo") == 51) {
|
if (stack.getOrCreateTag().getInt("ammo") == 51) {
|
||||||
n51.setScaleX(1);
|
n51.setScaleX(1);
|
||||||
n51.setScaleY(1);
|
n51.setScaleY(1);
|
||||||
} else {
|
} else {
|
||||||
|
@ -585,7 +585,7 @@ public class DevotionItemModel extends GeoModel<Devotion> {
|
||||||
n51.setScaleY(0);
|
n51.setScaleY(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("ammo") == 52) {
|
if (stack.getOrCreateTag().getInt("ammo") == 52) {
|
||||||
n52.setScaleX(1);
|
n52.setScaleX(1);
|
||||||
n52.setScaleY(1);
|
n52.setScaleY(1);
|
||||||
} else {
|
} else {
|
||||||
|
@ -593,7 +593,7 @@ public class DevotionItemModel extends GeoModel<Devotion> {
|
||||||
n52.setScaleY(0);
|
n52.setScaleY(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("ammo") == 53) {
|
if (stack.getOrCreateTag().getInt("ammo") == 53) {
|
||||||
n53.setScaleX(1);
|
n53.setScaleX(1);
|
||||||
n53.setScaleY(1);
|
n53.setScaleY(1);
|
||||||
} else {
|
} else {
|
||||||
|
@ -601,7 +601,7 @@ public class DevotionItemModel extends GeoModel<Devotion> {
|
||||||
n53.setScaleY(0);
|
n53.setScaleY(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("ammo") == 54) {
|
if (stack.getOrCreateTag().getInt("ammo") == 54) {
|
||||||
n54.setScaleX(1);
|
n54.setScaleX(1);
|
||||||
n54.setScaleY(1);
|
n54.setScaleY(1);
|
||||||
} else {
|
} else {
|
||||||
|
@ -609,7 +609,7 @@ public class DevotionItemModel extends GeoModel<Devotion> {
|
||||||
n54.setScaleY(0);
|
n54.setScaleY(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("ammo") == 55) {
|
if (stack.getOrCreateTag().getInt("ammo") == 55) {
|
||||||
n55.setScaleX(1);
|
n55.setScaleX(1);
|
||||||
n55.setScaleY(1);
|
n55.setScaleY(1);
|
||||||
} else {
|
} else {
|
||||||
|
@ -617,7 +617,7 @@ public class DevotionItemModel extends GeoModel<Devotion> {
|
||||||
n55.setScaleY(0);
|
n55.setScaleY(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("ammo") == 56) {
|
if (stack.getOrCreateTag().getInt("ammo") == 56) {
|
||||||
n56.setScaleX(1);
|
n56.setScaleX(1);
|
||||||
n56.setScaleY(1);
|
n56.setScaleY(1);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -47,31 +47,31 @@ public class M60ItemModel extends GeoModel<M60Item> {
|
||||||
r.setRotX(1.5f);
|
r.setRotX(1.5f);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("ammo") < 5 && stack.getOrCreateTag().getDouble("empty") == 1) {
|
if (stack.getOrCreateTag().getInt("ammo") < 5 && stack.getOrCreateTag().getDouble("empty") == 1) {
|
||||||
b5.setScaleX(0);
|
b5.setScaleX(0);
|
||||||
b5.setScaleY(0);
|
b5.setScaleY(0);
|
||||||
b5.setScaleZ(0);
|
b5.setScaleZ(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("ammo") < 4 && stack.getOrCreateTag().getDouble("empty") == 1) {
|
if (stack.getOrCreateTag().getInt("ammo") < 4 && stack.getOrCreateTag().getDouble("empty") == 1) {
|
||||||
b4.setScaleX(0);
|
b4.setScaleX(0);
|
||||||
b4.setScaleY(0);
|
b4.setScaleY(0);
|
||||||
b4.setScaleZ(0);
|
b4.setScaleZ(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("ammo") < 3 && stack.getOrCreateTag().getDouble("empty") == 1) {
|
if (stack.getOrCreateTag().getInt("ammo") < 3 && stack.getOrCreateTag().getDouble("empty") == 1) {
|
||||||
b3.setScaleX(0);
|
b3.setScaleX(0);
|
||||||
b3.setScaleY(0);
|
b3.setScaleY(0);
|
||||||
b3.setScaleZ(0);
|
b3.setScaleZ(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("ammo") < 2 && stack.getOrCreateTag().getDouble("empty") == 1) {
|
if (stack.getOrCreateTag().getInt("ammo") < 2 && stack.getOrCreateTag().getDouble("empty") == 1) {
|
||||||
b2.setScaleX(0);
|
b2.setScaleX(0);
|
||||||
b2.setScaleY(0);
|
b2.setScaleY(0);
|
||||||
b2.setScaleZ(0);
|
b2.setScaleZ(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("ammo") < 1 && stack.getOrCreateTag().getDouble("empty") == 1) {
|
if (stack.getOrCreateTag().getInt("ammo") < 1 && stack.getOrCreateTag().getDouble("empty") == 1) {
|
||||||
b1.setScaleX(0);
|
b1.setScaleX(0);
|
||||||
b1.setScaleY(0);
|
b1.setScaleY(0);
|
||||||
b1.setScaleZ(0);
|
b1.setScaleZ(0);
|
||||||
|
|
|
@ -173,8 +173,8 @@ public class SentinelItemModel extends GeoModel<SentinelItem> {
|
||||||
flare.setRotZ(0);
|
flare.setRotZ(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((stack.getOrCreateTag().getDouble("ammo") <= 5)) {
|
if ((stack.getOrCreateTag().getInt("ammo") <= 5)) {
|
||||||
ammo.setScaleX((float) (stack.getOrCreateTag().getDouble("ammo") / 5));
|
ammo.setScaleX((float) (stack.getOrCreateTag().getInt("ammo") / 5));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,11 +30,11 @@ public class SetAmmoCommand {
|
||||||
case SHOTGUN -> c.shotgunAmmo;
|
case SHOTGUN -> c.shotgunAmmo;
|
||||||
case SNIPER -> c.sniperAmmo;
|
case SNIPER -> c.sniperAmmo;
|
||||||
}
|
}
|
||||||
).orElse(0d);
|
).orElse(0);
|
||||||
context.getSource().sendSuccess(() -> Component.literal("Current " + type.name + " ammo: " + value), true);
|
context.getSource().sendSuccess(() -> Component.literal("Current " + type.name + " ammo: " + value), true);
|
||||||
return 0;
|
return 0;
|
||||||
})))
|
})))
|
||||||
.then(Commands.literal("set").then(Commands.argument("type", EnumArgument.enumArgument(GunInfo.Type.class)).then(Commands.argument("value", IntegerArgumentType.integer(0, 2147483647)).executes(context -> {
|
.then(Commands.literal("set").then(Commands.argument("type", EnumArgument.enumArgument(GunInfo.Type.class)).then(Commands.argument("value", IntegerArgumentType.integer(0)).executes(context -> {
|
||||||
var player = context.getSource().getPlayer();
|
var player = context.getSource().getPlayer();
|
||||||
if (player == null) return 0;
|
if (player == null) return 0;
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ public class SetAmmoCommand {
|
||||||
context.getSource().sendSuccess(() -> Component.literal("Set " + type.name + " ammo to: " + value), true);
|
context.getSource().sendSuccess(() -> Component.literal("Set " + type.name + " ammo to: " + value), true);
|
||||||
return 0;
|
return 0;
|
||||||
}))))
|
}))))
|
||||||
.then(Commands.literal("add").then(Commands.argument("type", EnumArgument.enumArgument(GunInfo.Type.class)).then(Commands.argument("value", IntegerArgumentType.integer(0, 2147483647)).executes(context -> {
|
.then(Commands.literal("add").then(Commands.argument("type", EnumArgument.enumArgument(GunInfo.Type.class)).then(Commands.argument("value", IntegerArgumentType.integer(0)).executes(context -> {
|
||||||
var player = context.getSource().getPlayer();
|
var player = context.getSource().getPlayer();
|
||||||
if (player == null) return 0;
|
if (player == null) return 0;
|
||||||
var type = context.getArgument("type", GunInfo.Type.class);
|
var type = context.getArgument("type", GunInfo.Type.class);
|
||||||
|
@ -66,6 +66,12 @@ public class SetAmmoCommand {
|
||||||
case SHOTGUN -> capability.shotgunAmmo += value;
|
case SHOTGUN -> capability.shotgunAmmo += value;
|
||||||
case SNIPER -> capability.sniperAmmo += value;
|
case SNIPER -> capability.sniperAmmo += value;
|
||||||
}
|
}
|
||||||
|
// 迫真溢出检测
|
||||||
|
if (capability.handgunAmmo < 0) capability.handgunAmmo = Integer.MAX_VALUE;
|
||||||
|
if (capability.rifleAmmo < 0) capability.rifleAmmo = Integer.MAX_VALUE;
|
||||||
|
if (capability.shotgunAmmo < 0) capability.shotgunAmmo = Integer.MAX_VALUE;
|
||||||
|
if (capability.sniperAmmo < 0) capability.sniperAmmo = Integer.MAX_VALUE;
|
||||||
|
|
||||||
capability.syncPlayerVariables(player);
|
capability.syncPlayerVariables(player);
|
||||||
});
|
});
|
||||||
context.getSource().sendSuccess(() -> Component.literal("Added " + type.name + " ammo of amount " + value), true);
|
context.getSource().sendSuccess(() -> Component.literal("Added " + type.name + " ammo of amount " + value), true);
|
||||||
|
|
|
@ -111,18 +111,18 @@ public class GunEventHandler {
|
||||||
private static void handleGunFire(Player player) {
|
private static void handleGunFire(Player player) {
|
||||||
ItemStack stack = player.getMainHandItem();
|
ItemStack stack = player.getMainHandItem();
|
||||||
if (stack.is(TargetModTags.Items.NORMAL_MAG_GUN)) {
|
if (stack.is(TargetModTags.Items.NORMAL_MAG_GUN)) {
|
||||||
double mode = stack.getOrCreateTag().getDouble("firemode");
|
double mode = stack.getOrCreateTag().getInt("firemode");
|
||||||
if (player.getPersistentData().getDouble("firing") == 0 && player.getMainHandItem().getItem() == TargetModItems.DEVOTION.get()) {
|
if (player.getPersistentData().getDouble("firing") == 0 && player.getMainHandItem().getItem() == TargetModItems.DEVOTION.get()) {
|
||||||
stack.getOrCreateTag().putDouble("fire_increase", 0);
|
stack.getOrCreateTag().putDouble("fire_increase", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player.getPersistentData().getDouble("firing") == 1
|
if (player.getPersistentData().getDouble("firing") == 1
|
||||||
&& stack.getOrCreateTag().getDouble("reloading") == 0
|
&& stack.getOrCreateTag().getDouble("reloading") == 0
|
||||||
&& stack.getOrCreateTag().getDouble("ammo") > 0
|
&& stack.getOrCreateTag().getInt("ammo") > 0
|
||||||
&& !player.getCooldowns().isOnCooldown(stack.getItem())
|
&& !player.getCooldowns().isOnCooldown(stack.getItem())
|
||||||
&& mode != 1) {
|
&& mode != 1) {
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("firemode") == 0) {
|
if (stack.getOrCreateTag().getInt("firemode") == 0) {
|
||||||
player.getPersistentData().putDouble("firing", 0);
|
player.getPersistentData().putDouble("firing", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -132,11 +132,11 @@ public class GunEventHandler {
|
||||||
stack.getOrCreateTag().putDouble("animindex", 1);
|
stack.getOrCreateTag().putDouble("animindex", 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("ammo") == 1) {
|
if (stack.getOrCreateTag().getInt("ammo") == 1) {
|
||||||
stack.getOrCreateTag().putDouble("gj", 1);
|
stack.getOrCreateTag().putDouble("gj", 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
stack.getOrCreateTag().putDouble("ammo", (stack.getOrCreateTag().getDouble("ammo") - 1));
|
stack.getOrCreateTag().putInt("ammo", (stack.getOrCreateTag().getInt("ammo") - 1));
|
||||||
stack.getOrCreateTag().putDouble("firecooldown", 7);
|
stack.getOrCreateTag().putDouble("firecooldown", 7);
|
||||||
stack.getOrCreateTag().putDouble("fireanim", 2);
|
stack.getOrCreateTag().putDouble("fireanim", 2);
|
||||||
stack.getOrCreateTag().putDouble("empty", 1);
|
stack.getOrCreateTag().putDouble("empty", 1);
|
||||||
|
|
|
@ -39,7 +39,7 @@ public class PlayerEventHandler {
|
||||||
|
|
||||||
for (ItemStack stack : player.getInventory().items) {
|
for (ItemStack stack : player.getInventory().items) {
|
||||||
if (stack.is(TargetModTags.Items.GUN)) {
|
if (stack.is(TargetModTags.Items.GUN)) {
|
||||||
stack.getOrCreateTag().putDouble("ammo", stack.getOrCreateTag().getDouble("mag"));
|
stack.getOrCreateTag().putInt("ammo", stack.getOrCreateTag().getInt("mag"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -180,47 +180,45 @@ public class PlayerEventHandler {
|
||||||
public static String handleAmmoCount(Player player) {
|
public static String handleAmmoCount(Player player) {
|
||||||
ItemStack stack = player.getMainHandItem();
|
ItemStack stack = player.getMainHandItem();
|
||||||
|
|
||||||
String firemode = "";
|
String firemode = switch (stack.getOrCreateTag().getInt("firemode")) {
|
||||||
if (stack.getOrCreateTag().getDouble("firemode") == 2) {
|
case 0 -> "Semi";
|
||||||
firemode = "Auto";
|
case 1 -> "Burst";
|
||||||
} else if (stack.getOrCreateTag().getDouble("firemode") == 1) {
|
case 2 -> "Auto";
|
||||||
firemode = "Burst";
|
default -> "";
|
||||||
} else if (stack.getOrCreateTag().getDouble("firemode") == 0) {
|
};
|
||||||
firemode = "Semi";
|
|
||||||
}
|
|
||||||
if (stack.getItem() == TargetModItems.BOCEK.get()) {
|
if (stack.getItem() == TargetModItems.BOCEK.get()) {
|
||||||
return (new java.text.DecimalFormat("##").format(stack.getOrCreateTag().getDouble("maxammo"))) + " " + firemode;
|
return (new java.text.DecimalFormat("##").format(stack.getOrCreateTag().getInt("maxammo"))) + " " + firemode;
|
||||||
}
|
}
|
||||||
if (stack.getItem() == TargetModItems.MINIGUN.get()) {
|
if (stack.getItem() == TargetModItems.MINIGUN.get()) {
|
||||||
return new java.text.DecimalFormat("##").format((player.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).rifleAmmo) + " " + firemode;
|
return new java.text.DecimalFormat("##").format((player.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).rifleAmmo) + " " + firemode;
|
||||||
}
|
}
|
||||||
if (stack.is(TargetModTags.Items.RIFLE)) {
|
if (stack.is(TargetModTags.Items.RIFLE)) {
|
||||||
stack.getOrCreateTag().putDouble("maxammo",
|
stack.getOrCreateTag().putInt("maxammo",
|
||||||
((player.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).rifleAmmo));
|
((player.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).rifleAmmo));
|
||||||
return (new java.text.DecimalFormat("##").format(stack.getOrCreateTag().getDouble("ammo"))) + "/"
|
return (new java.text.DecimalFormat("##").format(stack.getOrCreateTag().getInt("ammo"))) + "/"
|
||||||
+ new java.text.DecimalFormat("##").format((player.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).rifleAmmo) + " " + firemode;
|
+ new java.text.DecimalFormat("##").format((player.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).rifleAmmo) + " " + firemode;
|
||||||
}
|
}
|
||||||
if (stack.is(TargetModTags.Items.HANDGUN)
|
if (stack.is(TargetModTags.Items.HANDGUN)
|
||||||
|| stack.is(TargetModTags.Items.SMG)) {
|
|| stack.is(TargetModTags.Items.SMG)) {
|
||||||
stack.getOrCreateTag().putDouble("maxammo",
|
stack.getOrCreateTag().putInt("maxammo",
|
||||||
((player.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).handgunAmmo));
|
((player.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).handgunAmmo));
|
||||||
return (new java.text.DecimalFormat("##").format(stack.getOrCreateTag().getDouble("ammo"))) + "/"
|
return (new java.text.DecimalFormat("##").format(stack.getOrCreateTag().getInt("ammo"))) + "/"
|
||||||
+ new java.text.DecimalFormat("##").format((player.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).handgunAmmo) + " " + firemode;
|
+ new java.text.DecimalFormat("##").format((player.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).handgunAmmo) + " " + firemode;
|
||||||
}
|
}
|
||||||
if (stack.is(TargetModTags.Items.SHOTGUN)) {
|
if (stack.is(TargetModTags.Items.SHOTGUN)) {
|
||||||
stack.getOrCreateTag().putDouble("maxammo",
|
stack.getOrCreateTag().putInt("maxammo",
|
||||||
((player.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).shotgunAmmo));
|
((player.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).shotgunAmmo));
|
||||||
return (new java.text.DecimalFormat("##").format(stack.getOrCreateTag().getDouble("ammo"))) + "/"
|
return (new java.text.DecimalFormat("##").format(stack.getOrCreateTag().getInt("ammo"))) + "/"
|
||||||
+ new java.text.DecimalFormat("##").format((player.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).shotgunAmmo) + " " + firemode;
|
+ new java.text.DecimalFormat("##").format((player.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).shotgunAmmo) + " " + firemode;
|
||||||
}
|
}
|
||||||
if (stack.is(TargetModTags.Items.SNIPER_RIFLE)) {
|
if (stack.is(TargetModTags.Items.SNIPER_RIFLE)) {
|
||||||
stack.getOrCreateTag().putDouble("maxammo",
|
stack.getOrCreateTag().putInt("maxammo",
|
||||||
((player.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).sniperAmmo));
|
((player.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).sniperAmmo));
|
||||||
return (new java.text.DecimalFormat("##").format(stack.getOrCreateTag().getDouble("ammo"))) + "/"
|
return (new java.text.DecimalFormat("##").format(stack.getOrCreateTag().getInt("ammo"))) + "/"
|
||||||
+ new java.text.DecimalFormat("##").format((player.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).sniperAmmo) + " " + firemode;
|
+ new java.text.DecimalFormat("##").format((player.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).sniperAmmo) + " " + firemode;
|
||||||
}
|
}
|
||||||
return (new java.text.DecimalFormat("##").format(stack.getOrCreateTag().getDouble("ammo"))) + "/"
|
return (new java.text.DecimalFormat("##").format(stack.getOrCreateTag().getInt("ammo"))) + "/"
|
||||||
+ (new java.text.DecimalFormat("##").format(stack.getOrCreateTag().getDouble("maxammo"))) + " " + firemode;
|
+ (new java.text.DecimalFormat("##").format(stack.getOrCreateTag().getInt("maxammo"))) + " " + firemode;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void handleFireTime(Player player) {
|
private static void handleFireTime(Player player) {
|
||||||
|
@ -285,10 +283,10 @@ public class PlayerEventHandler {
|
||||||
private static void handleSpecialWeaponAmmo(Player player) {
|
private static void handleSpecialWeaponAmmo(Player player) {
|
||||||
ItemStack stack = player.getMainHandItem();
|
ItemStack stack = player.getMainHandItem();
|
||||||
|
|
||||||
if (stack.getItem() == TargetModItems.RPG.get() && stack.getOrCreateTag().getDouble("ammo") == 1) {
|
if (stack.getItem() == TargetModItems.RPG.get() && stack.getOrCreateTag().getInt("ammo") == 1) {
|
||||||
stack.getOrCreateTag().putDouble("empty", 0);
|
stack.getOrCreateTag().putDouble("empty", 0);
|
||||||
}
|
}
|
||||||
if (stack.getItem() == TargetModItems.BOCEK.get() && stack.getOrCreateTag().getDouble("ammo") == 1) {
|
if (stack.getItem() == TargetModItems.BOCEK.get() && stack.getOrCreateTag().getInt("ammo") == 1) {
|
||||||
stack.getOrCreateTag().putDouble("empty", 0);
|
stack.getOrCreateTag().putDouble("empty", 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -363,7 +361,7 @@ public class PlayerEventHandler {
|
||||||
|
|
||||||
if ((player.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).bowPullHold) {
|
if ((player.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).bowPullHold) {
|
||||||
if (mainHandItem.getItem() == TargetModItems.BOCEK.get()
|
if (mainHandItem.getItem() == TargetModItems.BOCEK.get()
|
||||||
&& tag.getDouble("maxammo") > 0
|
&& tag.getInt("maxammo") > 0
|
||||||
&& !player.getCooldowns().isOnCooldown(mainHandItem.getItem())
|
&& !player.getCooldowns().isOnCooldown(mainHandItem.getItem())
|
||||||
&& tag.getDouble("power") < 12
|
&& tag.getDouble("power") < 12
|
||||||
) {
|
) {
|
||||||
|
|
|
@ -98,11 +98,11 @@ public class AK47Item extends GunItem implements GeoItem, AnimatedItem {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.ak47.reload2"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.ak47.reload2"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("firemode") == 0 && stack.getOrCreateTag().getDouble("cg") > 0) {
|
if (stack.getOrCreateTag().getInt("firemode") == 0 && stack.getOrCreateTag().getDouble("cg") > 0) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.ak47.changefirerate2"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.ak47.changefirerate2"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("firemode") == 2 && stack.getOrCreateTag().getDouble("cg") > 0) {
|
if (stack.getOrCreateTag().getInt("firemode") == 2 && stack.getOrCreateTag().getDouble("cg") > 0) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.ak47.changefirerate"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.ak47.changefirerate"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -98,11 +98,11 @@ public class Aa12Item extends GunItem implements GeoItem, AnimatedItem {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.aa12.reload"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.aa12.reload"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("firemode") == 0 && stack.getOrCreateTag().getDouble("cg") > 0) {
|
if (stack.getOrCreateTag().getInt("firemode") == 0 && stack.getOrCreateTag().getDouble("cg") > 0) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.aa12.changefirerate2"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.aa12.changefirerate2"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("firemode") == 2 && stack.getOrCreateTag().getDouble("cg") > 0) {
|
if (stack.getOrCreateTag().getInt("firemode") == 2 && stack.getOrCreateTag().getDouble("cg") > 0) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.aa12.changefirerate"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.aa12.changefirerate"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -142,11 +142,22 @@ public class BocekItem extends GunItem implements GeoItem, AnimatedItem {
|
||||||
TooltipTool.addBocekTips(list, stack);
|
TooltipTool.addBocekTips(list, stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int getAmmoCount(Player player) {
|
||||||
|
int sum = 0;
|
||||||
|
for (int i = 0; i < player.getInventory().getContainerSize(); ++i) {
|
||||||
|
ItemStack itemstack = player.getInventory().getItem(i);
|
||||||
|
if (check(itemstack)) {
|
||||||
|
sum += itemstack.getCount();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return sum;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void inventoryTick(ItemStack itemstack, Level world, Entity entity, int slot, boolean selected) {
|
public void inventoryTick(ItemStack itemstack, Level world, Entity entity, int slot, boolean selected) {
|
||||||
super.inventoryTick(itemstack, world, entity, slot, selected);
|
super.inventoryTick(itemstack, world, entity, slot, selected);
|
||||||
if (entity instanceof Player player) {
|
if (entity instanceof Player player) {
|
||||||
itemstack.getOrCreateTag().putDouble("maxammo", getAmmoCount(player));
|
itemstack.getOrCreateTag().putInt("maxammo", getAmmoCount(player));
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO 合并至GunReload
|
// TODO 合并至GunReload
|
||||||
|
@ -157,17 +168,6 @@ public class BocekItem extends GunItem implements GeoItem, AnimatedItem {
|
||||||
WeaponDrawProcedure.execute(entity, itemstack);
|
WeaponDrawProcedure.execute(entity, itemstack);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static double getAmmoCount(Player player) {
|
|
||||||
double sum = 0.0;
|
|
||||||
for (int i = 0; i < player.getInventory().getContainerSize(); ++i) {
|
|
||||||
ItemStack itemstack = player.getInventory().getItem(i);
|
|
||||||
if (check(itemstack)) {
|
|
||||||
sum += itemstack.getCount();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return sum;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected static boolean check(ItemStack stack) {
|
protected static boolean check(ItemStack stack) {
|
||||||
return stack.getItem() == Items.ARROW;
|
return stack.getItem() == Items.ARROW;
|
||||||
}
|
}
|
||||||
|
|
|
@ -175,7 +175,7 @@ public class Devotion extends GunItem implements GeoItem, AnimatedItem {
|
||||||
itemTag.putDouble("reloading", 0);
|
itemTag.putDouble("reloading", 0);
|
||||||
itemTag.putDouble("reloadtime", 0);
|
itemTag.putDouble("reloadtime", 0);
|
||||||
}
|
}
|
||||||
if (itemTag.getDouble("reloading") == 1 && itemTag.getDouble("ammo") == 0) {
|
if (itemTag.getDouble("reloading") == 1 && itemTag.getInt("ammo") == 0) {
|
||||||
if (itemTag.getDouble("reloadtime") == 71) {
|
if (itemTag.getDouble("reloadtime") == 71) {
|
||||||
entity.getPersistentData().putDouble("id", id);
|
entity.getPersistentData().putDouble("id", id);
|
||||||
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
||||||
|
@ -196,7 +196,7 @@ public class Devotion extends GunItem implements GeoItem, AnimatedItem {
|
||||||
if (itemTag.getDouble("reloadtime") == 1 && mainHandItemTag.getDouble("id") == id) {
|
if (itemTag.getDouble("reloadtime") == 1 && mainHandItemTag.getDouble("id") == id) {
|
||||||
GunReload.reload(entity, GunInfo.Type.RIFLE);
|
GunReload.reload(entity, GunInfo.Type.RIFLE);
|
||||||
}
|
}
|
||||||
} else if (itemTag.getDouble("reloading") == 1 && itemTag.getDouble("ammo") > 0) {
|
} else if (itemTag.getDouble("reloading") == 1 && itemTag.getInt("ammo") > 0) {
|
||||||
if (itemTag.getDouble("reloadtime") == 51) {
|
if (itemTag.getDouble("reloadtime") == 51) {
|
||||||
entity.getPersistentData().putDouble("id", id);
|
entity.getPersistentData().putDouble("id", id);
|
||||||
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
||||||
|
|
|
@ -93,11 +93,11 @@ public class Hk416Item extends GunItem implements GeoItem, AnimatedItem {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m4.reload2"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m4.reload2"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("firemode") == 0 && stack.getOrCreateTag().getDouble("cg") > 0) {
|
if (stack.getOrCreateTag().getInt("firemode") == 0 && stack.getOrCreateTag().getDouble("cg") > 0) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m4.changefirerate2"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m4.changefirerate2"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("firemode") == 2 && stack.getOrCreateTag().getDouble("cg") > 0) {
|
if (stack.getOrCreateTag().getInt("firemode") == 2 && stack.getOrCreateTag().getDouble("cg") > 0) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m4.changefirerate"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m4.changefirerate"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -176,7 +176,7 @@ public class HuntingRifle extends GunItem implements GeoItem, AnimatedItem {
|
||||||
itemTag.putDouble("reloading", 0);
|
itemTag.putDouble("reloading", 0);
|
||||||
itemTag.putDouble("reloadtime", 0);
|
itemTag.putDouble("reloadtime", 0);
|
||||||
}
|
}
|
||||||
if (itemTag.getDouble("reloading") == 1 && itemTag.getDouble("ammo") == 0) {
|
if (itemTag.getDouble("reloading") == 1 && itemTag.getInt("ammo") == 0) {
|
||||||
if (itemTag.getDouble("reloadtime") == 61) {
|
if (itemTag.getDouble("reloadtime") == 61) {
|
||||||
entity.getPersistentData().putDouble("id", id);
|
entity.getPersistentData().putDouble("id", id);
|
||||||
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
||||||
|
|
|
@ -93,11 +93,11 @@ public class M4Item extends GunItem implements GeoItem, AnimatedItem {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m4.reload2"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m4.reload2"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("firemode") == 0 && stack.getOrCreateTag().getDouble("cg") > 0) {
|
if (stack.getOrCreateTag().getInt("firemode") == 0 && stack.getOrCreateTag().getDouble("cg") > 0) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m4.changefirerate2"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m4.changefirerate2"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("firemode") == 2 && stack.getOrCreateTag().getDouble("cg") > 0) {
|
if (stack.getOrCreateTag().getInt("firemode") == 2 && stack.getOrCreateTag().getDouble("cg") > 0) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m4.changefirerate"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m4.changefirerate"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -97,11 +97,11 @@ public class M60Item extends GunItem implements GeoItem, AnimatedItem {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m60.reload2"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m60.reload2"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("firemode") == 0 && stack.getOrCreateTag().getDouble("cg") > 0) {
|
if (stack.getOrCreateTag().getInt("firemode") == 0 && stack.getOrCreateTag().getDouble("cg") > 0) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m60.changefirerate2"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m60.changefirerate2"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("firemode") == 2 && stack.getOrCreateTag().getDouble("cg") > 0) {
|
if (stack.getOrCreateTag().getInt("firemode") == 2 && stack.getOrCreateTag().getDouble("cg") > 0) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m60.changefirerate"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m60.changefirerate"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -157,17 +157,8 @@ public class M79Item extends GunItem implements GeoItem, AnimatedItem {
|
||||||
TooltipTool.addGunTips(list, stack);
|
TooltipTool.addGunTips(list, stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public static int getAmmoCount(Player player) {
|
||||||
public void inventoryTick(ItemStack itemstack, Level world, Entity entity, int slot, boolean selected) {
|
int sum = 0;
|
||||||
super.inventoryTick(itemstack, world, entity, slot, selected);
|
|
||||||
if (entity instanceof Player player) {
|
|
||||||
itemstack.getOrCreateTag().putDouble("maxammo", getAmmoCount(player));
|
|
||||||
}
|
|
||||||
M79WuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure.execute(entity, itemstack);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static double getAmmoCount(Player player) {
|
|
||||||
double sum = 0.0;
|
|
||||||
for (int i = 0; i < player.getInventory().getContainerSize(); ++i) {
|
for (int i = 0; i < player.getInventory().getContainerSize(); ++i) {
|
||||||
ItemStack itemstack = player.getInventory().getItem(i);
|
ItemStack itemstack = player.getInventory().getItem(i);
|
||||||
if (check(itemstack)) {
|
if (check(itemstack)) {
|
||||||
|
@ -177,6 +168,15 @@ public class M79Item extends GunItem implements GeoItem, AnimatedItem {
|
||||||
return sum;
|
return sum;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void inventoryTick(ItemStack itemstack, Level world, Entity entity, int slot, boolean selected) {
|
||||||
|
super.inventoryTick(itemstack, world, entity, slot, selected);
|
||||||
|
if (entity instanceof Player player) {
|
||||||
|
itemstack.getOrCreateTag().putInt("maxammo", getAmmoCount(player));
|
||||||
|
}
|
||||||
|
M79WuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure.execute(entity, itemstack);
|
||||||
|
}
|
||||||
|
|
||||||
protected static boolean check(ItemStack stack) {
|
protected static boolean check(ItemStack stack) {
|
||||||
return stack.getItem() == TargetModItems.GRENADE_40MM.get();
|
return stack.getItem() == TargetModItems.GRENADE_40MM.get();
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,11 +93,11 @@ public class Mk14Item extends GunItem implements GeoItem, AnimatedItem {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.model.reload"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.model.reload"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("firemode") == 0 && stack.getOrCreateTag().getDouble("cg") > 0) {
|
if (stack.getOrCreateTag().getInt("firemode") == 0 && stack.getOrCreateTag().getDouble("cg") > 0) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.model.changefirerate2"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.model.changefirerate2"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("firemode") == 2 && stack.getOrCreateTag().getDouble("cg") > 0) {
|
if (stack.getOrCreateTag().getInt("firemode") == 2 && stack.getOrCreateTag().getDouble("cg") > 0) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.model.changefirerate"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.model.changefirerate"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -154,22 +154,8 @@ public class RpgItem extends GunItem implements GeoItem, AnimatedItem {
|
||||||
TooltipTool.addGunTips(list, stack);
|
TooltipTool.addGunTips(list, stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public static int getAmmoCount(Player player) {
|
||||||
public void inventoryTick(ItemStack itemstack, Level world, Entity entity, int slot, boolean selected) {
|
int sum = 0;
|
||||||
super.inventoryTick(itemstack, world, entity, slot, selected);
|
|
||||||
if (entity instanceof Player player) {
|
|
||||||
itemstack.getOrCreateTag().putDouble("maxammo", getAmmoCount(player));
|
|
||||||
}
|
|
||||||
RpgWuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure.execute(entity, itemstack);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Set<SoundEvent> getReloadSound() {
|
|
||||||
return Set.of(TargetModSounds.RPG_RELOAD.get());
|
|
||||||
}
|
|
||||||
|
|
||||||
public static double getAmmoCount(Player player) {
|
|
||||||
double sum = 0.0;
|
|
||||||
for (int i = 0; i < player.getInventory().getContainerSize(); ++i) {
|
for (int i = 0; i < player.getInventory().getContainerSize(); ++i) {
|
||||||
ItemStack itemstack = player.getInventory().getItem(i);
|
ItemStack itemstack = player.getInventory().getItem(i);
|
||||||
if (check(itemstack)) {
|
if (check(itemstack)) {
|
||||||
|
@ -179,6 +165,20 @@ public class RpgItem extends GunItem implements GeoItem, AnimatedItem {
|
||||||
return sum;
|
return sum;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Set<SoundEvent> getReloadSound() {
|
||||||
|
return Set.of(TargetModSounds.RPG_RELOAD.get());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void inventoryTick(ItemStack itemstack, Level world, Entity entity, int slot, boolean selected) {
|
||||||
|
super.inventoryTick(itemstack, world, entity, slot, selected);
|
||||||
|
if (entity instanceof Player player) {
|
||||||
|
itemstack.getOrCreateTag().putInt("maxammo", getAmmoCount(player));
|
||||||
|
}
|
||||||
|
RpgWuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure.execute(entity, itemstack);
|
||||||
|
}
|
||||||
|
|
||||||
protected static boolean check(ItemStack stack) {
|
protected static boolean check(ItemStack stack) {
|
||||||
return stack.getItem() == TargetModItems.ROCKET.get();
|
return stack.getItem() == TargetModItems.ROCKET.get();
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,11 +93,11 @@ public class RpkItem extends GunItem implements GeoItem, AnimatedItem {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.ak47.reload2"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.ak47.reload2"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("firemode") == 0 && stack.getOrCreateTag().getDouble("cg") > 0) {
|
if (stack.getOrCreateTag().getInt("firemode") == 0 && stack.getOrCreateTag().getDouble("cg") > 0) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.ak47.changefirerate2"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.ak47.changefirerate2"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("firemode") == 2 && stack.getOrCreateTag().getDouble("cg") > 0) {
|
if (stack.getOrCreateTag().getInt("firemode") == 2 && stack.getOrCreateTag().getDouble("cg") > 0) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.ak47.changefirerate"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.ak47.changefirerate"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -158,17 +158,8 @@ public class Taser extends GunItem implements GeoItem, AnimatedItem {
|
||||||
TooltipTool.addGunTips(list, stack);
|
TooltipTool.addGunTips(list, stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public static int getAmmoCount(Player player) {
|
||||||
public void inventoryTick(ItemStack itemstack, Level world, Entity entity, int slot, boolean selected) {
|
int sum = 0;
|
||||||
super.inventoryTick(itemstack, world, entity, slot, selected);
|
|
||||||
if (entity instanceof Player player) {
|
|
||||||
itemstack.getOrCreateTag().putDouble("maxammo", getAmmoCount(player));
|
|
||||||
}
|
|
||||||
TasercooldownProcedure.execute(entity, itemstack);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static double getAmmoCount(Player player) {
|
|
||||||
double sum = 0.0;
|
|
||||||
for (int i = 0; i < player.getInventory().getContainerSize(); ++i) {
|
for (int i = 0; i < player.getInventory().getContainerSize(); ++i) {
|
||||||
ItemStack itemstack = player.getInventory().getItem(i);
|
ItemStack itemstack = player.getInventory().getItem(i);
|
||||||
if (check(itemstack)) {
|
if (check(itemstack)) {
|
||||||
|
@ -178,6 +169,15 @@ public class Taser extends GunItem implements GeoItem, AnimatedItem {
|
||||||
return sum;
|
return sum;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void inventoryTick(ItemStack itemstack, Level world, Entity entity, int slot, boolean selected) {
|
||||||
|
super.inventoryTick(itemstack, world, entity, slot, selected);
|
||||||
|
if (entity instanceof Player player) {
|
||||||
|
itemstack.getOrCreateTag().putInt("maxammo", getAmmoCount(player));
|
||||||
|
}
|
||||||
|
TasercooldownProcedure.execute(entity, itemstack);
|
||||||
|
}
|
||||||
|
|
||||||
protected static boolean check(ItemStack stack) {
|
protected static boolean check(ItemStack stack) {
|
||||||
return stack.getItem() == TargetModItems.TASER_ELECTRODE.get();
|
return stack.getItem() == TargetModItems.TASER_ELECTRODE.get();
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,46 +85,40 @@ public class VectorItem extends GunItem implements GeoItem, AnimatedItem {
|
||||||
transformType = type;
|
transformType = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
private PlayState idlePredicate(AnimationState<VectorItem> event) {
|
@SubscribeEvent
|
||||||
LocalPlayer player = Minecraft.getInstance().player;
|
public static void handleBurstFire(TickEvent.PlayerTickEvent event) {
|
||||||
ItemStack stack = player.getMainHandItem();
|
if (event.phase != TickEvent.Phase.END) return;
|
||||||
|
|
||||||
if (this.animationProcedure.equals("empty")) {
|
var player = event.player;
|
||||||
if (stack.getOrCreateTag().getDouble("drawtime") < 11) {
|
ItemStack mainHandItem = player.getMainHandItem();
|
||||||
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.vec.draw"));
|
CompoundTag tag = mainHandItem.getOrCreateTag();
|
||||||
|
if (mainHandItem.is(TargetModTags.Items.GUN)) {
|
||||||
|
if (tag.getInt("firemode") == 1) {
|
||||||
|
player.getPersistentData().putDouble("firing", 0);
|
||||||
}
|
}
|
||||||
|
if (tag.getInt("ammo") == 0) {
|
||||||
if (stack.getOrCreateTag().getDouble("fireanim") > 0) {
|
tag.putDouble("burst", 0);
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.vec.fire"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("reloading") == 1 && stack.getOrCreateTag().getDouble("emptyreload") == 1) {
|
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.vec.reload"));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("reloading") == 1 && stack.getOrCreateTag().getDouble("emptyreload") == 0) {
|
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.vec.reload2"));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("firemode") == 0 && stack.getOrCreateTag().getDouble("cg") > 0) {
|
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.vec.changefirerate3"));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("firemode") == 1 && stack.getOrCreateTag().getDouble("cg") > 0) {
|
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.vec.changefirerate2"));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("firemode") == 2 && stack.getOrCreateTag().getDouble("cg") > 0) {
|
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.vec.changefirerate"));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (player.isSprinting() && player.onGround() && player.getPersistentData().getDouble("noRun") == 0) {
|
|
||||||
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.vec.run"));
|
|
||||||
}
|
|
||||||
|
|
||||||
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.vec.idle"));
|
|
||||||
}
|
}
|
||||||
return PlayState.STOP;
|
Item item = mainHandItem.getItem();
|
||||||
|
if (item == TargetModItems.VECTOR.get()
|
||||||
|
&& tag.getDouble("reloading") == 0
|
||||||
|
&& tag.getInt("ammo") > 0
|
||||||
|
&& !player.getCooldowns().isOnCooldown(item)
|
||||||
|
&& tag.getDouble("burst") > 0
|
||||||
|
) {
|
||||||
|
player.getCooldowns().addCooldown(item, tag.getDouble("burst") == 1 ? 5 : 1);
|
||||||
|
tag.putDouble("burst", tag.getDouble("burst") - 1);
|
||||||
|
tag.putDouble("fireanim", 2);
|
||||||
|
tag.putInt("ammo", (tag.getInt("ammo") - 1));
|
||||||
|
|
||||||
|
GunsTool.spawnBullet(player);
|
||||||
|
|
||||||
|
player.level().playSound(null, player.blockPosition(), TargetModSounds.VECTOR_FIRE_1P.get(), SoundSource.PLAYERS, 2, 1);
|
||||||
|
player.level().playSound(null, player.blockPosition(), TargetModSounds.VECTOR_FIRE_1P.get(), SoundSource.PLAYERS, 4, 1);
|
||||||
|
player.level().playSound(null, player.blockPosition(), TargetModSounds.VECTOR_FAR.get(), SoundSource.PLAYERS, 6, 1);
|
||||||
|
player.level().playSound(null, player.blockPosition(), TargetModSounds.VECTOR_VERYFAR.get(), SoundSource.PLAYERS, 12, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private PlayState procedurePredicate(AnimationState<VectorItem> event) {
|
private PlayState procedurePredicate(AnimationState<VectorItem> event) {
|
||||||
|
@ -160,63 +154,52 @@ public class VectorItem extends GunItem implements GeoItem, AnimatedItem {
|
||||||
TooltipTool.addGunTips(list, stack);
|
TooltipTool.addGunTips(list, stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public static ItemStack getGunInstance() {
|
||||||
public void inventoryTick(ItemStack itemStack, Level world, Entity entity, int slot, boolean selected) {
|
ItemStack stack = new ItemStack(TargetModItems.VECTOR.get());
|
||||||
super.inventoryTick(itemStack, world, entity, slot, selected);
|
GunsTool.initCreativeGun(stack, TargetModItems.VECTOR.getId().getPath());
|
||||||
|
return stack;
|
||||||
|
}
|
||||||
|
|
||||||
CompoundTag tag = itemStack.getOrCreateTag();
|
private PlayState idlePredicate(AnimationState<VectorItem> event) {
|
||||||
double id = tag.getDouble("id");
|
LocalPlayer player = Minecraft.getInstance().player;
|
||||||
var mainHandItem = entity instanceof LivingEntity living ? living.getMainHandItem() : ItemStack.EMPTY;
|
ItemStack stack = player.getMainHandItem();
|
||||||
if (mainHandItem.getOrCreateTag().getDouble("id") != tag.getDouble("id")) {
|
|
||||||
tag.putDouble("emptyreload", 0);
|
|
||||||
tag.putDouble("reloading", 0);
|
|
||||||
tag.putDouble("reloadtime", 0);
|
|
||||||
}
|
|
||||||
if (tag.getDouble("reloading") == 1 && tag.getDouble("ammo") == 0) {
|
|
||||||
if (tag.getDouble("reloadtime") == 61) {
|
|
||||||
entity.getPersistentData().putDouble("id", id);
|
|
||||||
if (entity instanceof ServerPlayer serverPlayer) {
|
|
||||||
serverPlayer.connection.send(new ClientboundSoundPacket(new Holder.Direct<>(ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("target:vector_reload_empty"))),
|
|
||||||
SoundSource.PLAYERS, serverPlayer.getX(), serverPlayer.getY(), serverPlayer.getZ(), 10f, 1f, serverPlayer.level().random.nextLong()));
|
|
||||||
}
|
|
||||||
// entity.level().playSound(null, entity.blockPosition(), TargetModSounds.VECTOR_RELOAD_EMPTY.get(), SoundSource.PLAYERS, 100, 1);
|
|
||||||
}
|
|
||||||
if (mainHandItem.getItem() == itemStack.getItem()
|
|
||||||
&& mainHandItem.getOrCreateTag().getDouble("id") == id
|
|
||||||
&& tag.getDouble("reloadtime") > 0) {
|
|
||||||
tag.putDouble("reloadtime", tag.getDouble("reloadtime") - 1);
|
|
||||||
} else {
|
|
||||||
tag.putDouble("reloading", 0);
|
|
||||||
tag.putDouble("emptyreload", 0);
|
|
||||||
tag.putDouble("reloadtime", 0);
|
|
||||||
}
|
|
||||||
if (tag.getDouble("reloadtime") == 1 && mainHandItem.getOrCreateTag().getDouble("id") == id) {
|
|
||||||
GunReload.reload(entity, GunInfo.Type.HANDGUN);
|
|
||||||
}
|
|
||||||
} else if (tag.getDouble("reloading") == 1 && tag.getDouble("ammo") > 0) {
|
|
||||||
if (tag.getDouble("reloadtime") == 47) {
|
|
||||||
entity.getPersistentData().putDouble("id", id);
|
|
||||||
if (entity instanceof ServerPlayer serverPlayer) {
|
|
||||||
serverPlayer.connection.send(new ClientboundSoundPacket(new Holder.Direct<>(ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("target:vector_reload_normal"))),
|
|
||||||
SoundSource.PLAYERS, serverPlayer.getX(), serverPlayer.getY(), serverPlayer.getZ(), 10f, 1f, serverPlayer.level().random.nextLong()));
|
|
||||||
}
|
|
||||||
// entity.level().playSound(null, entity.blockPosition(), TargetModSounds.VECTOR_RELOAD_NORMAL.get(), SoundSource.PLAYERS, 100, 1);
|
|
||||||
}
|
|
||||||
if (mainHandItem.getItem() == itemStack.getItem()
|
|
||||||
&& mainHandItem.getOrCreateTag().getDouble("id") == id
|
|
||||||
&& tag.getDouble("reloadtime") > 0) {
|
|
||||||
tag.putDouble("reloadtime", (tag.getDouble("reloadtime") - 1));
|
|
||||||
} else {
|
|
||||||
tag.putDouble("reloading", 0);
|
|
||||||
tag.putDouble("emptyreload", 0);
|
|
||||||
tag.putDouble("reloadtime", 0);
|
|
||||||
}
|
|
||||||
if (tag.getDouble("reloadtime") == 1 && mainHandItem.getOrCreateTag().getDouble("id") == id) {
|
|
||||||
GunReload.reload(entity, GunInfo.Type.HANDGUN, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
WeaponDrawLightProcedure.execute(entity, itemStack);
|
if (this.animationProcedure.equals("empty")) {
|
||||||
|
if (stack.getOrCreateTag().getDouble("drawtime") < 11) {
|
||||||
|
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.vec.draw"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stack.getOrCreateTag().getDouble("fireanim") > 0) {
|
||||||
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.vec.fire"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stack.getOrCreateTag().getDouble("reloading") == 1 && stack.getOrCreateTag().getDouble("emptyreload") == 1) {
|
||||||
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.vec.reload"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stack.getOrCreateTag().getDouble("reloading") == 1 && stack.getOrCreateTag().getDouble("emptyreload") == 0) {
|
||||||
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.vec.reload2"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stack.getOrCreateTag().getInt("firemode") == 0 && stack.getOrCreateTag().getDouble("cg") > 0) {
|
||||||
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.vec.changefirerate3"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stack.getOrCreateTag().getInt("firemode") == 1 && stack.getOrCreateTag().getDouble("cg") > 0) {
|
||||||
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.vec.changefirerate2"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stack.getOrCreateTag().getInt("firemode") == 2 && stack.getOrCreateTag().getDouble("cg") > 0) {
|
||||||
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.vec.changefirerate"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (player.isSprinting() && player.onGround() && player.getPersistentData().getDouble("noRun") == 0) {
|
||||||
|
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.vec.run"));
|
||||||
|
}
|
||||||
|
|
||||||
|
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.vec.idle"));
|
||||||
|
}
|
||||||
|
return PlayState.STOP;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -246,50 +229,67 @@ public class VectorItem extends GunItem implements GeoItem, AnimatedItem {
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ItemStack getGunInstance() {
|
|
||||||
ItemStack stack = new ItemStack(TargetModItems.VECTOR.get());
|
|
||||||
GunsTool.initCreativeGun(stack, TargetModItems.VECTOR.getId().getPath());
|
|
||||||
return stack;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setAnimationProcedure(String procedure) {
|
public void setAnimationProcedure(String procedure) {
|
||||||
this.animationProcedure = procedure;
|
this.animationProcedure = procedure;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@Override
|
||||||
public static void handleBurstFire(TickEvent.PlayerTickEvent event) {
|
public void inventoryTick(ItemStack itemStack, Level world, Entity entity, int slot, boolean selected) {
|
||||||
if (event.phase != TickEvent.Phase.END) return;
|
super.inventoryTick(itemStack, world, entity, slot, selected);
|
||||||
|
|
||||||
var player = event.player;
|
CompoundTag tag = itemStack.getOrCreateTag();
|
||||||
ItemStack mainHandItem = player.getMainHandItem();
|
double id = tag.getDouble("id");
|
||||||
CompoundTag tag = mainHandItem.getOrCreateTag();
|
var mainHandItem = entity instanceof LivingEntity living ? living.getMainHandItem() : ItemStack.EMPTY;
|
||||||
if (mainHandItem.is(TargetModTags.Items.GUN)) {
|
if (mainHandItem.getOrCreateTag().getDouble("id") != tag.getDouble("id")) {
|
||||||
if (tag.getDouble("firemode") == 1) {
|
tag.putDouble("emptyreload", 0);
|
||||||
player.getPersistentData().putDouble("firing", 0);
|
tag.putDouble("reloading", 0);
|
||||||
|
tag.putDouble("reloadtime", 0);
|
||||||
|
}
|
||||||
|
if (tag.getDouble("reloading") == 1 && tag.getInt("ammo") == 0) {
|
||||||
|
if (tag.getDouble("reloadtime") == 61) {
|
||||||
|
entity.getPersistentData().putDouble("id", id);
|
||||||
|
if (entity instanceof ServerPlayer serverPlayer) {
|
||||||
|
serverPlayer.connection.send(new ClientboundSoundPacket(new Holder.Direct<>(ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("target:vector_reload_empty"))),
|
||||||
|
SoundSource.PLAYERS, serverPlayer.getX(), serverPlayer.getY(), serverPlayer.getZ(), 10f, 1f, serverPlayer.level().random.nextLong()));
|
||||||
|
}
|
||||||
|
// entity.level().playSound(null, entity.blockPosition(), TargetModSounds.VECTOR_RELOAD_EMPTY.get(), SoundSource.PLAYERS, 100, 1);
|
||||||
}
|
}
|
||||||
if (tag.getDouble("ammo") == 0) {
|
if (mainHandItem.getItem() == itemStack.getItem()
|
||||||
tag.putDouble("burst", 0);
|
&& mainHandItem.getOrCreateTag().getDouble("id") == id
|
||||||
|
&& tag.getDouble("reloadtime") > 0) {
|
||||||
|
tag.putDouble("reloadtime", tag.getDouble("reloadtime") - 1);
|
||||||
|
} else {
|
||||||
|
tag.putDouble("reloading", 0);
|
||||||
|
tag.putDouble("emptyreload", 0);
|
||||||
|
tag.putDouble("reloadtime", 0);
|
||||||
|
}
|
||||||
|
if (tag.getDouble("reloadtime") == 1 && mainHandItem.getOrCreateTag().getDouble("id") == id) {
|
||||||
|
GunReload.reload(entity, GunInfo.Type.HANDGUN);
|
||||||
|
}
|
||||||
|
} else if (tag.getDouble("reloading") == 1 && tag.getInt("ammo") > 0) {
|
||||||
|
if (tag.getDouble("reloadtime") == 47) {
|
||||||
|
entity.getPersistentData().putDouble("id", id);
|
||||||
|
if (entity instanceof ServerPlayer serverPlayer) {
|
||||||
|
serverPlayer.connection.send(new ClientboundSoundPacket(new Holder.Direct<>(ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("target:vector_reload_normal"))),
|
||||||
|
SoundSource.PLAYERS, serverPlayer.getX(), serverPlayer.getY(), serverPlayer.getZ(), 10f, 1f, serverPlayer.level().random.nextLong()));
|
||||||
|
}
|
||||||
|
// entity.level().playSound(null, entity.blockPosition(), TargetModSounds.VECTOR_RELOAD_NORMAL.get(), SoundSource.PLAYERS, 100, 1);
|
||||||
|
}
|
||||||
|
if (mainHandItem.getItem() == itemStack.getItem()
|
||||||
|
&& mainHandItem.getOrCreateTag().getDouble("id") == id
|
||||||
|
&& tag.getDouble("reloadtime") > 0) {
|
||||||
|
tag.putDouble("reloadtime", (tag.getDouble("reloadtime") - 1));
|
||||||
|
} else {
|
||||||
|
tag.putDouble("reloading", 0);
|
||||||
|
tag.putDouble("emptyreload", 0);
|
||||||
|
tag.putDouble("reloadtime", 0);
|
||||||
|
}
|
||||||
|
if (tag.getDouble("reloadtime") == 1 && mainHandItem.getOrCreateTag().getDouble("id") == id) {
|
||||||
|
GunReload.reload(entity, GunInfo.Type.HANDGUN, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Item item = mainHandItem.getItem();
|
|
||||||
if (item == TargetModItems.VECTOR.get()
|
|
||||||
&& tag.getDouble("reloading") == 0
|
|
||||||
&& tag.getDouble("ammo") > 0
|
|
||||||
&& !player.getCooldowns().isOnCooldown(item)
|
|
||||||
&& tag.getDouble("burst") > 0
|
|
||||||
) {
|
|
||||||
player.getCooldowns().addCooldown(item, tag.getDouble("burst") == 1 ? 5 : 1);
|
|
||||||
tag.putDouble("burst", tag.getDouble("burst") - 1);
|
|
||||||
tag.putDouble("fireanim", 2);
|
|
||||||
tag.putDouble("ammo", (tag.getDouble("ammo") - 1));
|
|
||||||
|
|
||||||
GunsTool.spawnBullet(player);
|
WeaponDrawLightProcedure.execute(entity, itemStack);
|
||||||
|
|
||||||
player.level().playSound(null, player.blockPosition(), TargetModSounds.VECTOR_FIRE_1P.get(), SoundSource.PLAYERS, 2, 1);
|
|
||||||
player.level().playSound(null, player.blockPosition(), TargetModSounds.VECTOR_FIRE_1P.get(), SoundSource.PLAYERS, 4, 1);
|
|
||||||
player.level().playSound(null, player.blockPosition(), TargetModSounds.VECTOR_FAR.get(), SoundSource.PLAYERS, 6, 1);
|
|
||||||
player.level().playSound(null, player.blockPosition(), TargetModSounds.VECTOR_VERYFAR.get(), SoundSource.PLAYERS, 12, 1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -62,7 +62,7 @@ public class FireModeMessage {
|
||||||
SoundSource.PLAYERS, serverPlayer.getX(), serverPlayer.getY(), serverPlayer.getZ(), 1f, 1f, serverPlayer.level().random.nextLong()));
|
SoundSource.PLAYERS, serverPlayer.getX(), serverPlayer.getY(), serverPlayer.getZ(), 1f, 1f, serverPlayer.level().random.nextLong()));
|
||||||
}
|
}
|
||||||
|
|
||||||
tag.putDouble("firemode", mode);
|
tag.putInt("firemode", mode);
|
||||||
tag.putDouble("cg", 10);
|
tag.putDouble("cg", 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ public class FireModeMessage {
|
||||||
ItemStack mainHandItem = player.getMainHandItem();
|
ItemStack mainHandItem = player.getMainHandItem();
|
||||||
CompoundTag tag = mainHandItem.getOrCreateTag();
|
CompoundTag tag = mainHandItem.getOrCreateTag();
|
||||||
Item item = mainHandItem.getItem();
|
Item item = mainHandItem.getItem();
|
||||||
int fireMode = (int) tag.getDouble("firemode");
|
int fireMode = (int) tag.getInt("firemode");
|
||||||
|
|
||||||
if (item == TargetModItems.AK_47.get()
|
if (item == TargetModItems.AK_47.get()
|
||||||
|| item == TargetModItems.M_4.get()
|
|| item == TargetModItems.M_4.get()
|
||||||
|
|
|
@ -272,11 +272,11 @@ public class TargetModVariables {
|
||||||
public double recoilHorizon = 0;
|
public double recoilHorizon = 0;
|
||||||
public double firing = 0;
|
public double firing = 0;
|
||||||
public double targetAngle = 0;
|
public double targetAngle = 0;
|
||||||
public double rifleAmmo = 0;
|
public int rifleAmmo = 0;
|
||||||
public boolean refresh = false;
|
public boolean refresh = false;
|
||||||
public double handgunAmmo = 0;
|
public int handgunAmmo = 0;
|
||||||
public double shotgunAmmo = 0;
|
public int shotgunAmmo = 0;
|
||||||
public double sniperAmmo = 0;
|
public int sniperAmmo = 0;
|
||||||
public boolean bowPullHold = false;
|
public boolean bowPullHold = false;
|
||||||
public boolean bowPull = false;
|
public boolean bowPull = false;
|
||||||
public boolean playerDoubleJump = false;
|
public boolean playerDoubleJump = false;
|
||||||
|
@ -297,11 +297,11 @@ public class TargetModVariables {
|
||||||
nbt.putDouble("recoil_horizon", recoilHorizon);
|
nbt.putDouble("recoil_horizon", recoilHorizon);
|
||||||
nbt.putDouble("firing", firing);
|
nbt.putDouble("firing", firing);
|
||||||
nbt.putDouble("target_angle", targetAngle);
|
nbt.putDouble("target_angle", targetAngle);
|
||||||
nbt.putDouble("rifle_ammo", rifleAmmo);
|
nbt.putInt("rifle_ammo", rifleAmmo);
|
||||||
nbt.putBoolean("refresh", refresh);
|
nbt.putBoolean("refresh", refresh);
|
||||||
nbt.putDouble("handgun_ammo", handgunAmmo);
|
nbt.putInt("handgun_ammo", handgunAmmo);
|
||||||
nbt.putDouble("shotgun_ammo", shotgunAmmo);
|
nbt.putInt("shotgun_ammo", shotgunAmmo);
|
||||||
nbt.putDouble("sniper_ammo", sniperAmmo);
|
nbt.putInt("sniper_ammo", sniperAmmo);
|
||||||
nbt.putBoolean("bow_pull_hold", bowPullHold);
|
nbt.putBoolean("bow_pull_hold", bowPullHold);
|
||||||
nbt.putBoolean("bow_pull", bowPull);
|
nbt.putBoolean("bow_pull", bowPull);
|
||||||
nbt.putBoolean("player_double_jump", playerDoubleJump);
|
nbt.putBoolean("player_double_jump", playerDoubleJump);
|
||||||
|
@ -319,11 +319,11 @@ public class TargetModVariables {
|
||||||
recoilHorizon = nbt.getDouble("recoil_horizon");
|
recoilHorizon = nbt.getDouble("recoil_horizon");
|
||||||
firing = nbt.getDouble("firing");
|
firing = nbt.getDouble("firing");
|
||||||
targetAngle = nbt.getDouble("target_angle");
|
targetAngle = nbt.getDouble("target_angle");
|
||||||
rifleAmmo = nbt.getDouble("rifle_ammo");
|
rifleAmmo = nbt.getInt("rifle_ammo");
|
||||||
refresh = nbt.getBoolean("refresh");
|
refresh = nbt.getBoolean("refresh");
|
||||||
handgunAmmo = nbt.getDouble("handgun_ammo");
|
handgunAmmo = nbt.getInt("handgun_ammo");
|
||||||
shotgunAmmo = nbt.getDouble("shotgun_ammo");
|
shotgunAmmo = nbt.getInt("shotgun_ammo");
|
||||||
sniperAmmo = nbt.getDouble("sniper_ammo");
|
sniperAmmo = nbt.getInt("sniper_ammo");
|
||||||
bowPullHold = nbt.getBoolean("bow_pull_hold");
|
bowPullHold = nbt.getBoolean("bow_pull_hold");
|
||||||
bowPull = nbt.getBoolean("bow_pull");
|
bowPull = nbt.getBoolean("bow_pull");
|
||||||
playerDoubleJump = nbt.getBoolean("player_double_jump");
|
playerDoubleJump = nbt.getBoolean("player_double_jump");
|
||||||
|
|
|
@ -20,7 +20,7 @@ public class AK47WuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure {
|
||||||
itemstack.getOrCreateTag().putDouble("reloading", 0);
|
itemstack.getOrCreateTag().putDouble("reloading", 0);
|
||||||
itemstack.getOrCreateTag().putDouble("reloadtime", 0);
|
itemstack.getOrCreateTag().putDouble("reloadtime", 0);
|
||||||
}
|
}
|
||||||
if (itemstack.getOrCreateTag().getDouble("reloading") == 1 && itemstack.getOrCreateTag().getDouble("ammo") == 0) {
|
if (itemstack.getOrCreateTag().getDouble("reloading") == 1 && itemstack.getOrCreateTag().getInt("ammo") == 0) {
|
||||||
if (itemstack.getOrCreateTag().getDouble("reloadtime") == 57) {
|
if (itemstack.getOrCreateTag().getDouble("reloadtime") == 57) {
|
||||||
entity.getPersistentData().putDouble("id", id);
|
entity.getPersistentData().putDouble("id", id);
|
||||||
{
|
{
|
||||||
|
@ -43,7 +43,7 @@ public class AK47WuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure {
|
||||||
if (itemstack.getOrCreateTag().getDouble("reloadtime") == 1 && (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
if (itemstack.getOrCreateTag().getDouble("reloadtime") == 1 && (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
||||||
GunReload.reload(entity, GunInfo.Type.RIFLE);
|
GunReload.reload(entity, GunInfo.Type.RIFLE);
|
||||||
}
|
}
|
||||||
} else if (itemstack.getOrCreateTag().getDouble("reloading") == 1 && itemstack.getOrCreateTag().getDouble("ammo") > 0) {
|
} else if (itemstack.getOrCreateTag().getDouble("reloading") == 1 && itemstack.getOrCreateTag().getInt("ammo") > 0) {
|
||||||
if (itemstack.getOrCreateTag().getDouble("reloadtime") == 41) {
|
if (itemstack.getOrCreateTag().getDouble("reloadtime") == 41) {
|
||||||
entity.getPersistentData().putDouble("id", id);
|
entity.getPersistentData().putDouble("id", id);
|
||||||
{
|
{
|
||||||
|
|
|
@ -17,7 +17,7 @@ public class Aa12WuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure {
|
||||||
itemstack.getOrCreateTag().putDouble("reloading", 0);
|
itemstack.getOrCreateTag().putDouble("reloading", 0);
|
||||||
itemstack.getOrCreateTag().putDouble("reloadtime", 0);
|
itemstack.getOrCreateTag().putDouble("reloadtime", 0);
|
||||||
}
|
}
|
||||||
if (itemstack.getOrCreateTag().getDouble("reloading") == 1 && itemstack.getOrCreateTag().getDouble("ammo") == 0) {
|
if (itemstack.getOrCreateTag().getDouble("reloading") == 1 && itemstack.getOrCreateTag().getInt("ammo") == 0) {
|
||||||
if (itemstack.getOrCreateTag().getDouble("reloadtime") == 55) {
|
if (itemstack.getOrCreateTag().getDouble("reloadtime") == 55) {
|
||||||
entity.getPersistentData().putDouble("id", id);
|
entity.getPersistentData().putDouble("id", id);
|
||||||
{
|
{
|
||||||
|
@ -40,7 +40,7 @@ public class Aa12WuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure {
|
||||||
if (itemstack.getOrCreateTag().getDouble("reloadtime") == 1 && (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
if (itemstack.getOrCreateTag().getDouble("reloadtime") == 1 && (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
||||||
GunReload.reload(entity, GunInfo.Type.SHOTGUN);
|
GunReload.reload(entity, GunInfo.Type.SHOTGUN);
|
||||||
}
|
}
|
||||||
} else if (itemstack.getOrCreateTag().getDouble("reloading") == 1 && itemstack.getOrCreateTag().getDouble("ammo") > 0) {
|
} else if (itemstack.getOrCreateTag().getDouble("reloading") == 1 && itemstack.getOrCreateTag().getInt("ammo") > 0) {
|
||||||
if (itemstack.getOrCreateTag().getDouble("reloadtime") == 44) {
|
if (itemstack.getOrCreateTag().getDouble("reloadtime") == 44) {
|
||||||
entity.getPersistentData().putDouble("id", id);
|
entity.getPersistentData().putDouble("id", id);
|
||||||
{
|
{
|
||||||
|
|
|
@ -12,16 +12,16 @@ public class AbekiriWuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure {
|
||||||
public static void execute(Entity entity, ItemStack itemstack) {
|
public static void execute(Entity entity, ItemStack itemstack) {
|
||||||
if (entity == null)
|
if (entity == null)
|
||||||
return;
|
return;
|
||||||
double ammo1 = 0;
|
int ammo1 = 0;
|
||||||
double id = 0;
|
double id = 0;
|
||||||
id = itemstack.getOrCreateTag().getDouble("id");
|
id = itemstack.getOrCreateTag().getDouble("id");
|
||||||
ammo1 = 2 - itemstack.getOrCreateTag().getDouble("ammo");
|
ammo1 = 2 - itemstack.getOrCreateTag().getInt("ammo");
|
||||||
if ((entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") != itemstack.getOrCreateTag().getDouble("id")) {
|
if ((entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") != itemstack.getOrCreateTag().getDouble("id")) {
|
||||||
itemstack.getOrCreateTag().putDouble("emptyreload", 0);
|
itemstack.getOrCreateTag().putDouble("emptyreload", 0);
|
||||||
itemstack.getOrCreateTag().putDouble("reloading", 0);
|
itemstack.getOrCreateTag().putDouble("reloading", 0);
|
||||||
itemstack.getOrCreateTag().putDouble("reloadtime", 0);
|
itemstack.getOrCreateTag().putDouble("reloadtime", 0);
|
||||||
}
|
}
|
||||||
if (itemstack.getOrCreateTag().getDouble("reloading") == 1 && itemstack.getOrCreateTag().getDouble("ammo") == 0) {
|
if (itemstack.getOrCreateTag().getDouble("reloading") == 1 && itemstack.getOrCreateTag().getInt("ammo") == 0) {
|
||||||
if (itemstack.getOrCreateTag().getDouble("reloadtime") == 99) {
|
if (itemstack.getOrCreateTag().getDouble("reloadtime") == 99) {
|
||||||
entity.getPersistentData().putDouble("id", id);
|
entity.getPersistentData().putDouble("id", id);
|
||||||
{
|
{
|
||||||
|
@ -44,28 +44,28 @@ public class AbekiriWuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure {
|
||||||
if (itemstack.getOrCreateTag().getDouble("reloadtime") == 1 && (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
if (itemstack.getOrCreateTag().getDouble("reloadtime") == 1 && (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
||||||
if ((entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).shotgunAmmo >= ammo1) {
|
if ((entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).shotgunAmmo >= ammo1) {
|
||||||
{
|
{
|
||||||
double _setval = (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).shotgunAmmo - ammo1;
|
int _setval = (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).shotgunAmmo - ammo1;
|
||||||
entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> {
|
entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> {
|
||||||
capability.shotgunAmmo = _setval;
|
capability.shotgunAmmo = _setval;
|
||||||
capability.syncPlayerVariables(entity);
|
capability.syncPlayerVariables(entity);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
itemstack.getOrCreateTag().putDouble("ammo", (itemstack.getOrCreateTag().getDouble("ammo") + ammo1));
|
itemstack.getOrCreateTag().putInt("ammo", (itemstack.getOrCreateTag().getInt("ammo") + ammo1));
|
||||||
itemstack.getOrCreateTag().putDouble("reloading", 0);
|
itemstack.getOrCreateTag().putDouble("reloading", 0);
|
||||||
itemstack.getOrCreateTag().putDouble("emptyreload", 0);
|
itemstack.getOrCreateTag().putDouble("emptyreload", 0);
|
||||||
} else {
|
} else {
|
||||||
{
|
{
|
||||||
double _setval = itemstack.getOrCreateTag().getDouble("ammo") + (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).shotgunAmmo;
|
int _setval = itemstack.getOrCreateTag().getInt("ammo") + (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).shotgunAmmo;
|
||||||
entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> {
|
entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> {
|
||||||
capability.shotgunAmmo = _setval;
|
capability.shotgunAmmo = _setval;
|
||||||
capability.syncPlayerVariables(entity);
|
capability.syncPlayerVariables(entity);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
itemstack.getOrCreateTag().putDouble("maxammo", 0);
|
itemstack.getOrCreateTag().putInt("maxammo", 0);
|
||||||
itemstack.getOrCreateTag().putDouble("reloading", 0);
|
itemstack.getOrCreateTag().putDouble("reloading", 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (itemstack.getOrCreateTag().getDouble("reloading") == 1 && itemstack.getOrCreateTag().getDouble("ammo") == 1) {
|
} else if (itemstack.getOrCreateTag().getDouble("reloading") == 1 && itemstack.getOrCreateTag().getInt("ammo") == 1) {
|
||||||
if (itemstack.getOrCreateTag().getDouble("reloadtime") == 83) {
|
if (itemstack.getOrCreateTag().getDouble("reloadtime") == 83) {
|
||||||
entity.getPersistentData().putDouble("id", id);
|
entity.getPersistentData().putDouble("id", id);
|
||||||
{
|
{
|
||||||
|
@ -88,24 +88,24 @@ public class AbekiriWuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure {
|
||||||
if (itemstack.getOrCreateTag().getDouble("reloadtime") == 1 && (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
if (itemstack.getOrCreateTag().getDouble("reloadtime") == 1 && (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
||||||
if ((entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).shotgunAmmo >= ammo1) {
|
if ((entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).shotgunAmmo >= ammo1) {
|
||||||
{
|
{
|
||||||
double _setval = (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).shotgunAmmo - ammo1;
|
int _setval = (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).shotgunAmmo - ammo1;
|
||||||
entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> {
|
entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> {
|
||||||
capability.shotgunAmmo = _setval;
|
capability.shotgunAmmo = _setval;
|
||||||
capability.syncPlayerVariables(entity);
|
capability.syncPlayerVariables(entity);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
itemstack.getOrCreateTag().putDouble("ammo", (itemstack.getOrCreateTag().getDouble("ammo") + ammo1));
|
itemstack.getOrCreateTag().putInt("ammo", (itemstack.getOrCreateTag().getInt("ammo") + ammo1));
|
||||||
itemstack.getOrCreateTag().putDouble("reloading", 0);
|
itemstack.getOrCreateTag().putDouble("reloading", 0);
|
||||||
itemstack.getOrCreateTag().putDouble("emptyreload", 0);
|
itemstack.getOrCreateTag().putDouble("emptyreload", 0);
|
||||||
} else {
|
} else {
|
||||||
{
|
{
|
||||||
double _setval = itemstack.getOrCreateTag().getDouble("ammo") + (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).shotgunAmmo;
|
int _setval = itemstack.getOrCreateTag().getInt("ammo") + (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).shotgunAmmo;
|
||||||
entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> {
|
entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> {
|
||||||
capability.shotgunAmmo = _setval;
|
capability.shotgunAmmo = _setval;
|
||||||
capability.syncPlayerVariables(entity);
|
capability.syncPlayerVariables(entity);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
itemstack.getOrCreateTag().putDouble("maxammo", 0);
|
itemstack.getOrCreateTag().putInt("maxammo", 0);
|
||||||
itemstack.getOrCreateTag().putDouble("reloading", 0);
|
itemstack.getOrCreateTag().putDouble("reloading", 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ public class Hk416WuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure {
|
||||||
itemstack.getOrCreateTag().putDouble("reloading", 0);
|
itemstack.getOrCreateTag().putDouble("reloading", 0);
|
||||||
itemstack.getOrCreateTag().putDouble("reloadtime", 0);
|
itemstack.getOrCreateTag().putDouble("reloadtime", 0);
|
||||||
}
|
}
|
||||||
if (itemstack.getOrCreateTag().getDouble("reloading") == 1 && itemstack.getOrCreateTag().getDouble("ammo") == 0) {
|
if (itemstack.getOrCreateTag().getDouble("reloading") == 1 && itemstack.getOrCreateTag().getInt("ammo") == 0) {
|
||||||
if (itemstack.getOrCreateTag().getDouble("reloadtime") == 55) {
|
if (itemstack.getOrCreateTag().getDouble("reloadtime") == 55) {
|
||||||
entity.getPersistentData().putDouble("id", id);
|
entity.getPersistentData().putDouble("id", id);
|
||||||
{
|
{
|
||||||
|
@ -43,7 +43,7 @@ public class Hk416WuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure {
|
||||||
if (itemstack.getOrCreateTag().getDouble("reloadtime") == 1 && (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
if (itemstack.getOrCreateTag().getDouble("reloadtime") == 1 && (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
||||||
GunReload.reload(entity, GunInfo.Type.RIFLE);
|
GunReload.reload(entity, GunInfo.Type.RIFLE);
|
||||||
}
|
}
|
||||||
} else if (itemstack.getOrCreateTag().getDouble("reloading") == 1 && itemstack.getOrCreateTag().getDouble("ammo") > 0) {
|
} else if (itemstack.getOrCreateTag().getDouble("reloading") == 1 && itemstack.getOrCreateTag().getInt("ammo") > 0) {
|
||||||
if (itemstack.getOrCreateTag().getDouble("reloadtime") == 41) {
|
if (itemstack.getOrCreateTag().getDouble("reloadtime") == 41) {
|
||||||
entity.getPersistentData().putDouble("id", id);
|
entity.getPersistentData().putDouble("id", id);
|
||||||
{
|
{
|
||||||
|
|
|
@ -20,7 +20,7 @@ public class KraberWuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure {
|
||||||
itemstack.getOrCreateTag().putDouble("reloading", 0);
|
itemstack.getOrCreateTag().putDouble("reloading", 0);
|
||||||
itemstack.getOrCreateTag().putDouble("reloadtime", 0);
|
itemstack.getOrCreateTag().putDouble("reloadtime", 0);
|
||||||
}
|
}
|
||||||
if (itemstack.getOrCreateTag().getDouble("reloading") == 1 && itemstack.getOrCreateTag().getDouble("ammo") == 0) {
|
if (itemstack.getOrCreateTag().getDouble("reloading") == 1 && itemstack.getOrCreateTag().getInt("ammo") == 0) {
|
||||||
if (itemstack.getOrCreateTag().getDouble("reloadtime") == 83) {
|
if (itemstack.getOrCreateTag().getDouble("reloadtime") == 83) {
|
||||||
entity.getPersistentData().putDouble("id", id);
|
entity.getPersistentData().putDouble("id", id);
|
||||||
{
|
{
|
||||||
|
@ -43,7 +43,7 @@ public class KraberWuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure {
|
||||||
if (itemstack.getOrCreateTag().getDouble("reloadtime") == 1 && (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
if (itemstack.getOrCreateTag().getDouble("reloadtime") == 1 && (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
||||||
GunReload.reload(entity, GunInfo.Type.SNIPER);
|
GunReload.reload(entity, GunInfo.Type.SNIPER);
|
||||||
}
|
}
|
||||||
} else if (itemstack.getOrCreateTag().getDouble("reloading") == 1 && itemstack.getOrCreateTag().getDouble("ammo") > 0) {
|
} else if (itemstack.getOrCreateTag().getDouble("reloading") == 1 && itemstack.getOrCreateTag().getInt("ammo") > 0) {
|
||||||
if (itemstack.getOrCreateTag().getDouble("reloadtime") == 65) {
|
if (itemstack.getOrCreateTag().getDouble("reloadtime") == 65) {
|
||||||
entity.getPersistentData().putDouble("id", id);
|
entity.getPersistentData().putDouble("id", id);
|
||||||
{
|
{
|
||||||
|
|
|
@ -14,7 +14,7 @@ public class KraberfireProcedure {
|
||||||
|
|
||||||
ItemStack usehand = player.getMainHandItem();
|
ItemStack usehand = player.getMainHandItem();
|
||||||
if (usehand.getItem() == TargetModItems.KRABER.get() && usehand.getOrCreateTag().getDouble("reloading") == 0 && !player.getCooldowns().isOnCooldown(usehand.getItem())
|
if (usehand.getItem() == TargetModItems.KRABER.get() && usehand.getOrCreateTag().getDouble("reloading") == 0 && !player.getCooldowns().isOnCooldown(usehand.getItem())
|
||||||
&& usehand.getOrCreateTag().getDouble("ammo") > 0) {
|
&& usehand.getOrCreateTag().getInt("ammo") > 0) {
|
||||||
usehand.getOrCreateTag().putDouble("fireanim", 40);
|
usehand.getOrCreateTag().putDouble("fireanim", 40);
|
||||||
GunsTool.spawnBullet(player);
|
GunsTool.spawnBullet(player);
|
||||||
player.getCooldowns().addCooldown(usehand.getItem(), 40);
|
player.getCooldowns().addCooldown(usehand.getItem(), 40);
|
||||||
|
@ -29,7 +29,7 @@ public class KraberfireProcedure {
|
||||||
player.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, player.position(), player.getRotationVector(), (ServerLevel) player.level(), 4,
|
player.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, player.position(), player.getRotationVector(), (ServerLevel) player.level(), 4,
|
||||||
player.getName().getString(), player.getDisplayName(), player.level().getServer(), player), "playsound target:kraber_veryfar player @a ~ ~ ~ 24 1");
|
player.getName().getString(), player.getDisplayName(), player.level().getServer(), player), "playsound target:kraber_veryfar player @a ~ ~ ~ 24 1");
|
||||||
}
|
}
|
||||||
usehand.getOrCreateTag().putDouble("ammo", (usehand.getOrCreateTag().getDouble("ammo") - 1));
|
usehand.getOrCreateTag().putInt("ammo", (usehand.getOrCreateTag().getInt("ammo") - 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ public class M4WuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure {
|
||||||
itemstack.getOrCreateTag().putDouble("reloading", 0);
|
itemstack.getOrCreateTag().putDouble("reloading", 0);
|
||||||
itemstack.getOrCreateTag().putDouble("reloadtime", 0);
|
itemstack.getOrCreateTag().putDouble("reloadtime", 0);
|
||||||
}
|
}
|
||||||
if (itemstack.getOrCreateTag().getDouble("reloading") == 1 && itemstack.getOrCreateTag().getDouble("ammo") == 0) {
|
if (itemstack.getOrCreateTag().getDouble("reloading") == 1 && itemstack.getOrCreateTag().getInt("ammo") == 0) {
|
||||||
if (itemstack.getOrCreateTag().getDouble("reloadtime") == 55) {
|
if (itemstack.getOrCreateTag().getDouble("reloadtime") == 55) {
|
||||||
{
|
{
|
||||||
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
||||||
|
@ -43,7 +43,7 @@ public class M4WuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure {
|
||||||
if (itemstack.getOrCreateTag().getDouble("reloadtime") == 1 && (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
if (itemstack.getOrCreateTag().getDouble("reloadtime") == 1 && (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
||||||
GunReload.reload(entity, GunInfo.Type.RIFLE);
|
GunReload.reload(entity, GunInfo.Type.RIFLE);
|
||||||
}
|
}
|
||||||
} else if (itemstack.getOrCreateTag().getDouble("reloading") == 1 && itemstack.getOrCreateTag().getDouble("ammo") > 0) {
|
} else if (itemstack.getOrCreateTag().getDouble("reloading") == 1 && itemstack.getOrCreateTag().getInt("ammo") > 0) {
|
||||||
if (itemstack.getOrCreateTag().getDouble("reloadtime") == 41) {
|
if (itemstack.getOrCreateTag().getDouble("reloadtime") == 41) {
|
||||||
{
|
{
|
||||||
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
||||||
|
|
|
@ -20,7 +20,7 @@ public class M60WuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure {
|
||||||
itemstack.getOrCreateTag().putDouble("reloading", 0);
|
itemstack.getOrCreateTag().putDouble("reloading", 0);
|
||||||
itemstack.getOrCreateTag().putDouble("reloadtime", 0);
|
itemstack.getOrCreateTag().putDouble("reloadtime", 0);
|
||||||
}
|
}
|
||||||
if (itemstack.getOrCreateTag().getDouble("reloading") == 1 && itemstack.getOrCreateTag().getDouble("ammo") == 0) {
|
if (itemstack.getOrCreateTag().getDouble("reloading") == 1 && itemstack.getOrCreateTag().getInt("ammo") == 0) {
|
||||||
if (itemstack.getOrCreateTag().getDouble("reloadtime") == 129) {
|
if (itemstack.getOrCreateTag().getDouble("reloadtime") == 129) {
|
||||||
entity.getPersistentData().putDouble("id", id);
|
entity.getPersistentData().putDouble("id", id);
|
||||||
{
|
{
|
||||||
|
@ -46,7 +46,7 @@ public class M60WuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure {
|
||||||
if (itemstack.getOrCreateTag().getDouble("reloadtime") == 1 && (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
if (itemstack.getOrCreateTag().getDouble("reloadtime") == 1 && (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
||||||
GunReload.reload(entity, GunInfo.Type.RIFLE);
|
GunReload.reload(entity, GunInfo.Type.RIFLE);
|
||||||
}
|
}
|
||||||
} else if (itemstack.getOrCreateTag().getDouble("reloading") == 1 && itemstack.getOrCreateTag().getDouble("ammo") > 0) {
|
} else if (itemstack.getOrCreateTag().getDouble("reloading") == 1 && itemstack.getOrCreateTag().getInt("ammo") > 0) {
|
||||||
if (itemstack.getOrCreateTag().getDouble("reloadtime") == 111) {
|
if (itemstack.getOrCreateTag().getDouble("reloadtime") == 111) {
|
||||||
entity.getPersistentData().putDouble("id", id);
|
entity.getPersistentData().putDouble("id", id);
|
||||||
{
|
{
|
||||||
|
|
|
@ -13,10 +13,8 @@ public class M79WuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure {
|
||||||
public static void execute(Entity entity, ItemStack itemstack) {
|
public static void execute(Entity entity, ItemStack itemstack) {
|
||||||
if (entity == null)
|
if (entity == null)
|
||||||
return;
|
return;
|
||||||
double id;
|
double id = itemstack.getOrCreateTag().getDouble("id");
|
||||||
double ammo1;
|
int ammo1 = 1 - itemstack.getOrCreateTag().getInt("ammo");
|
||||||
id = itemstack.getOrCreateTag().getDouble("id");
|
|
||||||
ammo1 = 1 - itemstack.getOrCreateTag().getDouble("ammo");
|
|
||||||
if ((entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") != itemstack.getOrCreateTag().getDouble("id")) {
|
if ((entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") != itemstack.getOrCreateTag().getDouble("id")) {
|
||||||
itemstack.getOrCreateTag().putDouble("emptyreload", 0);
|
itemstack.getOrCreateTag().putDouble("emptyreload", 0);
|
||||||
itemstack.getOrCreateTag().putDouble("reloading", 0);
|
itemstack.getOrCreateTag().putDouble("reloading", 0);
|
||||||
|
@ -43,8 +41,8 @@ public class M79WuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure {
|
||||||
itemstack.getOrCreateTag().putDouble("emptyreload", 0);
|
itemstack.getOrCreateTag().putDouble("emptyreload", 0);
|
||||||
}
|
}
|
||||||
if (itemstack.getOrCreateTag().getDouble("reloadtime") == 1 && (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
if (itemstack.getOrCreateTag().getDouble("reloadtime") == 1 && (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
||||||
if (itemstack.getOrCreateTag().getDouble("maxammo") >= ammo1) {
|
if (itemstack.getOrCreateTag().getInt("maxammo") >= ammo1) {
|
||||||
itemstack.getOrCreateTag().putDouble("ammo", (itemstack.getOrCreateTag().getDouble("ammo") + ammo1));
|
itemstack.getOrCreateTag().putInt("ammo", (itemstack.getOrCreateTag().getInt("ammo") + ammo1));
|
||||||
if (entity instanceof Player _player) {
|
if (entity instanceof Player _player) {
|
||||||
ItemStack _stktoremove = new ItemStack(TargetModItems.GRENADE_40MM.get());
|
ItemStack _stktoremove = new ItemStack(TargetModItems.GRENADE_40MM.get());
|
||||||
_player.getInventory().clearOrCountMatchingItems(p -> _stktoremove.getItem() == p.getItem(), 1, _player.inventoryMenu.getCraftSlots());
|
_player.getInventory().clearOrCountMatchingItems(p -> _stktoremove.getItem() == p.getItem(), 1, _player.inventoryMenu.getCraftSlots());
|
||||||
|
@ -52,7 +50,7 @@ public class M79WuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure {
|
||||||
itemstack.getOrCreateTag().putDouble("reloading", 0);
|
itemstack.getOrCreateTag().putDouble("reloading", 0);
|
||||||
itemstack.getOrCreateTag().putDouble("emptyreload", 0);
|
itemstack.getOrCreateTag().putDouble("emptyreload", 0);
|
||||||
} else {
|
} else {
|
||||||
itemstack.getOrCreateTag().putDouble("ammo", (itemstack.getOrCreateTag().getDouble("ammo") + itemstack.getOrCreateTag().getDouble("maxammo")));
|
itemstack.getOrCreateTag().putInt("ammo", (itemstack.getOrCreateTag().getInt("ammo") + itemstack.getOrCreateTag().getInt("maxammo")));
|
||||||
if (entity instanceof Player _player) {
|
if (entity instanceof Player _player) {
|
||||||
ItemStack _stktoremove = new ItemStack(TargetModItems.GRENADE_40MM.get());
|
ItemStack _stktoremove = new ItemStack(TargetModItems.GRENADE_40MM.get());
|
||||||
_player.getInventory().clearOrCountMatchingItems(p -> _stktoremove.getItem() == p.getItem(), 1, _player.inventoryMenu.getCraftSlots());
|
_player.getInventory().clearOrCountMatchingItems(p -> _stktoremove.getItem() == p.getItem(), 1, _player.inventoryMenu.getCraftSlots());
|
||||||
|
|
|
@ -22,7 +22,7 @@ public class M79fireProcedure {
|
||||||
if (entity instanceof Player player && !player.isSpectator()) {
|
if (entity instanceof Player player && !player.isSpectator()) {
|
||||||
ItemStack usehand = player.getMainHandItem();
|
ItemStack usehand = player.getMainHandItem();
|
||||||
if (usehand.getItem() == TargetModItems.M_79.get() && usehand.getOrCreateTag().getDouble("reloading") == 0 && !(entity instanceof Player _plrCldCheck4 && _plrCldCheck4.getCooldowns().isOnCooldown(usehand.getItem()))
|
if (usehand.getItem() == TargetModItems.M_79.get() && usehand.getOrCreateTag().getDouble("reloading") == 0 && !(entity instanceof Player _plrCldCheck4 && _plrCldCheck4.getCooldowns().isOnCooldown(usehand.getItem()))
|
||||||
&& usehand.getOrCreateTag().getDouble("ammo") > 0) {
|
&& usehand.getOrCreateTag().getInt("ammo") > 0) {
|
||||||
entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> {
|
entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> {
|
||||||
capability.recoilHorizon = Math.random() < 0.5 ? -1 : 1;
|
capability.recoilHorizon = Math.random() < 0.5 ? -1 : 1;
|
||||||
capability.recoil = 0.1;
|
capability.recoil = 0.1;
|
||||||
|
@ -68,7 +68,7 @@ public class M79fireProcedure {
|
||||||
entity.getName().getString(), entity.getDisplayName(), entity.level().getServer(), entity), "playsound target:m_79_veryfar player @a ~ ~ ~ 12 1");
|
entity.getName().getString(), entity.getDisplayName(), entity.level().getServer(), entity), "playsound target:m_79_veryfar player @a ~ ~ ~ 12 1");
|
||||||
}
|
}
|
||||||
usehand.getOrCreateTag().putDouble("fireanim", 2);
|
usehand.getOrCreateTag().putDouble("fireanim", 2);
|
||||||
usehand.getOrCreateTag().putDouble("ammo", (usehand.getOrCreateTag().getDouble("ammo") - 1));
|
usehand.getOrCreateTag().putInt("ammo", (usehand.getOrCreateTag().getInt("ammo") - 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ public class M870WuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure {
|
||||||
double ammo1 = 0;
|
double ammo1 = 0;
|
||||||
double id = 0;
|
double id = 0;
|
||||||
id = itemstack.getOrCreateTag().getDouble("id");
|
id = itemstack.getOrCreateTag().getDouble("id");
|
||||||
ammo1 = 8 - itemstack.getOrCreateTag().getDouble("ammo");
|
ammo1 = 8 - itemstack.getOrCreateTag().getInt("ammo");
|
||||||
if ((entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") != itemstack.getOrCreateTag().getDouble("id")) {
|
if ((entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") != itemstack.getOrCreateTag().getDouble("id")) {
|
||||||
itemstack.getOrCreateTag().putDouble("finish", 0);
|
itemstack.getOrCreateTag().putDouble("finish", 0);
|
||||||
itemstack.getOrCreateTag().putDouble("reloading", 0);
|
itemstack.getOrCreateTag().putDouble("reloading", 0);
|
||||||
|
@ -40,9 +40,9 @@ public class M870WuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure {
|
||||||
}
|
}
|
||||||
if (itemstack.getOrCreateTag().getDouble("reloading") == 1 && (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
if (itemstack.getOrCreateTag().getDouble("reloading") == 1 && (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
||||||
if (itemstack.getOrCreateTag().getDouble("prepare") == 10 && itemstack.getOrCreateTag().getDouble("emptyreload") == 1) {
|
if (itemstack.getOrCreateTag().getDouble("prepare") == 10 && itemstack.getOrCreateTag().getDouble("emptyreload") == 1) {
|
||||||
itemstack.getOrCreateTag().putDouble("ammo", (itemstack.getOrCreateTag().getDouble("ammo") + 1));
|
itemstack.getOrCreateTag().putInt("ammo", (itemstack.getOrCreateTag().getInt("ammo") + 1));
|
||||||
{
|
{
|
||||||
double _setval = (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).shotgunAmmo - 1;
|
int _setval = (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).shotgunAmmo - 1;
|
||||||
entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> {
|
entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> {
|
||||||
capability.shotgunAmmo = _setval;
|
capability.shotgunAmmo = _setval;
|
||||||
capability.syncPlayerVariables(entity);
|
capability.syncPlayerVariables(entity);
|
||||||
|
@ -50,7 +50,7 @@ public class M870WuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (itemstack.getOrCreateTag().getDouble("prepare") == 0 && itemstack.getOrCreateTag().getDouble("loading") == 0
|
if (itemstack.getOrCreateTag().getDouble("prepare") == 0 && itemstack.getOrCreateTag().getDouble("loading") == 0
|
||||||
&& !(itemstack.getOrCreateTag().getDouble("ammo") >= 8 || (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).shotgunAmmo == 0)) {
|
&& !(itemstack.getOrCreateTag().getInt("ammo") >= 8 || (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).shotgunAmmo == 0)) {
|
||||||
if (itemstack.getOrCreateTag().getDouble("forcestop") == 1) {
|
if (itemstack.getOrCreateTag().getDouble("forcestop") == 1) {
|
||||||
itemstack.getOrCreateTag().putDouble("stop", 1);
|
itemstack.getOrCreateTag().putDouble("stop", 1);
|
||||||
} else {
|
} else {
|
||||||
|
@ -71,16 +71,16 @@ public class M870WuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (itemstack.getOrCreateTag().getDouble("loading") == 9) {
|
if (itemstack.getOrCreateTag().getDouble("loading") == 9) {
|
||||||
itemstack.getOrCreateTag().putDouble("ammo", (itemstack.getOrCreateTag().getDouble("ammo") + 1));
|
itemstack.getOrCreateTag().putInt("ammo", (itemstack.getOrCreateTag().getInt("ammo") + 1));
|
||||||
{
|
{
|
||||||
double _setval = (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).shotgunAmmo - 1;
|
int _setval = (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).shotgunAmmo - 1;
|
||||||
entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> {
|
entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> {
|
||||||
capability.shotgunAmmo = _setval;
|
capability.shotgunAmmo = _setval;
|
||||||
capability.syncPlayerVariables(entity);
|
capability.syncPlayerVariables(entity);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((itemstack.getOrCreateTag().getDouble("ammo") >= 8 || (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).shotgunAmmo == 0)
|
if ((itemstack.getOrCreateTag().getInt("ammo") >= 8 || (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).shotgunAmmo == 0)
|
||||||
&& itemstack.getOrCreateTag().getDouble("loading") == 0 || itemstack.getOrCreateTag().getDouble("stop") == 1) {
|
&& itemstack.getOrCreateTag().getDouble("loading") == 0 || itemstack.getOrCreateTag().getDouble("stop") == 1) {
|
||||||
itemstack.getOrCreateTag().putDouble("forcestop", 0);
|
itemstack.getOrCreateTag().putDouble("forcestop", 0);
|
||||||
itemstack.getOrCreateTag().putDouble("stop", 0);
|
itemstack.getOrCreateTag().putDouble("stop", 0);
|
||||||
|
|
|
@ -13,11 +13,11 @@ public class M870fireProcedure {
|
||||||
if (player.isSpectator()) return;
|
if (player.isSpectator()) return;
|
||||||
|
|
||||||
ItemStack usehand = player.getMainHandItem();
|
ItemStack usehand = player.getMainHandItem();
|
||||||
if (usehand.getOrCreateTag().getDouble("reloading") == 1 && usehand.getOrCreateTag().getDouble("prepare") == 0 && usehand.getOrCreateTag().getDouble("ammo") > 0) {
|
if (usehand.getOrCreateTag().getDouble("reloading") == 1 && usehand.getOrCreateTag().getDouble("prepare") == 0 && usehand.getOrCreateTag().getInt("ammo") > 0) {
|
||||||
usehand.getOrCreateTag().putDouble("forcestop", 1);
|
usehand.getOrCreateTag().putDouble("forcestop", 1);
|
||||||
}
|
}
|
||||||
if (usehand.getItem() == TargetModItems.M_870.get() && usehand.getOrCreateTag().getDouble("reloading") == 0 && !player.getCooldowns().isOnCooldown(usehand.getItem())
|
if (usehand.getItem() == TargetModItems.M_870.get() && usehand.getOrCreateTag().getDouble("reloading") == 0 && !player.getCooldowns().isOnCooldown(usehand.getItem())
|
||||||
&& usehand.getOrCreateTag().getDouble("ammo") > 0) {
|
&& usehand.getOrCreateTag().getInt("ammo") > 0) {
|
||||||
for (int index0 = 0; index0 < 12; index0++) {
|
for (int index0 = 0; index0 < 12; index0++) {
|
||||||
GunsTool.spawnBullet(player);
|
GunsTool.spawnBullet(player);
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ public class M870fireProcedure {
|
||||||
player.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, player.position(), player.getRotationVector(), (ServerLevel) player.level(), 4,
|
player.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, player.position(), player.getRotationVector(), (ServerLevel) player.level(), 4,
|
||||||
player.getName().getString(), player.getDisplayName(), player.level().getServer(), player), "playsound target:m_870_veryfar player @a ~ ~ ~ 24 1");
|
player.getName().getString(), player.getDisplayName(), player.level().getServer(), player), "playsound target:m_870_veryfar player @a ~ ~ ~ 24 1");
|
||||||
}
|
}
|
||||||
usehand.getOrCreateTag().putDouble("ammo", (usehand.getOrCreateTag().getDouble("ammo") - 1));
|
usehand.getOrCreateTag().putInt("ammo", (usehand.getOrCreateTag().getInt("ammo") - 1));
|
||||||
usehand.getOrCreateTag().putDouble("fireanim", 2);
|
usehand.getOrCreateTag().putDouble("fireanim", 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,14 +17,14 @@ public class M98bWuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure {
|
||||||
double id = 0;
|
double id = 0;
|
||||||
double ammo2 = 0;
|
double ammo2 = 0;
|
||||||
id = itemstack.getOrCreateTag().getDouble("id");
|
id = itemstack.getOrCreateTag().getDouble("id");
|
||||||
ammo1 = 5 - itemstack.getOrCreateTag().getDouble("ammo");
|
ammo1 = 5 - itemstack.getOrCreateTag().getInt("ammo");
|
||||||
ammo2 = 6 - itemstack.getOrCreateTag().getDouble("ammo");
|
ammo2 = 6 - itemstack.getOrCreateTag().getInt("ammo");
|
||||||
if ((entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") != itemstack.getOrCreateTag().getDouble("id")) {
|
if ((entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") != itemstack.getOrCreateTag().getDouble("id")) {
|
||||||
itemstack.getOrCreateTag().putDouble("emptyreload", 0);
|
itemstack.getOrCreateTag().putDouble("emptyreload", 0);
|
||||||
itemstack.getOrCreateTag().putDouble("reloading", 0);
|
itemstack.getOrCreateTag().putDouble("reloading", 0);
|
||||||
itemstack.getOrCreateTag().putDouble("reloadtime", 0);
|
itemstack.getOrCreateTag().putDouble("reloadtime", 0);
|
||||||
}
|
}
|
||||||
if (itemstack.getOrCreateTag().getDouble("reloading") == 1 && itemstack.getOrCreateTag().getDouble("ammo") == 0) {
|
if (itemstack.getOrCreateTag().getDouble("reloading") == 1 && itemstack.getOrCreateTag().getInt("ammo") == 0) {
|
||||||
if (itemstack.getOrCreateTag().getDouble("reloadtime") == 79) {
|
if (itemstack.getOrCreateTag().getDouble("reloadtime") == 79) {
|
||||||
entity.getPersistentData().putDouble("id", id);
|
entity.getPersistentData().putDouble("id", id);
|
||||||
{
|
{
|
||||||
|
@ -47,7 +47,7 @@ public class M98bWuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure {
|
||||||
if (itemstack.getOrCreateTag().getDouble("reloadtime") == 1 && (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
if (itemstack.getOrCreateTag().getDouble("reloadtime") == 1 && (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
||||||
GunReload.reload(entity, GunInfo.Type.SNIPER);
|
GunReload.reload(entity, GunInfo.Type.SNIPER);
|
||||||
}
|
}
|
||||||
} else if (itemstack.getOrCreateTag().getDouble("reloading") == 1 && itemstack.getOrCreateTag().getDouble("ammo") > 0) {
|
} else if (itemstack.getOrCreateTag().getDouble("reloading") == 1 && itemstack.getOrCreateTag().getInt("ammo") > 0) {
|
||||||
if (itemstack.getOrCreateTag().getDouble("reloadtime") == 57) {
|
if (itemstack.getOrCreateTag().getDouble("reloadtime") == 57) {
|
||||||
entity.getPersistentData().putDouble("id", id);
|
entity.getPersistentData().putDouble("id", id);
|
||||||
{
|
{
|
||||||
|
|
|
@ -14,7 +14,7 @@ public class M98bfireProcedure {
|
||||||
|
|
||||||
ItemStack usehand = player.getMainHandItem();
|
ItemStack usehand = player.getMainHandItem();
|
||||||
if (usehand.getItem() == TargetModItems.M_98B.get() && usehand.getOrCreateTag().getDouble("reloading") == 0 && !(player.getCooldowns().isOnCooldown(usehand.getItem()))
|
if (usehand.getItem() == TargetModItems.M_98B.get() && usehand.getOrCreateTag().getDouble("reloading") == 0 && !(player.getCooldowns().isOnCooldown(usehand.getItem()))
|
||||||
&& usehand.getOrCreateTag().getDouble("ammo") > 0) {
|
&& usehand.getOrCreateTag().getInt("ammo") > 0) {
|
||||||
usehand.getOrCreateTag().putDouble("fireanim", 17);
|
usehand.getOrCreateTag().putDouble("fireanim", 17);
|
||||||
GunsTool.spawnBullet(player);
|
GunsTool.spawnBullet(player);
|
||||||
player.getCooldowns().addCooldown(usehand.getItem(), 17);
|
player.getCooldowns().addCooldown(usehand.getItem(), 17);
|
||||||
|
@ -29,7 +29,7 @@ public class M98bfireProcedure {
|
||||||
player.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, player.position(), player.getRotationVector(), (ServerLevel) player.level(), 4,
|
player.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, player.position(), player.getRotationVector(), (ServerLevel) player.level(), 4,
|
||||||
player.getName().getString(), player.getDisplayName(), player.level().getServer(), player), "playsound target:m_98b_veryfar player @a ~ ~ ~ 24 1");
|
player.getName().getString(), player.getDisplayName(), player.level().getServer(), player), "playsound target:m_98b_veryfar player @a ~ ~ ~ 24 1");
|
||||||
}
|
}
|
||||||
usehand.getOrCreateTag().putDouble("ammo", (usehand.getOrCreateTag().getDouble("ammo") - 1));
|
usehand.getOrCreateTag().putInt("ammo", (usehand.getOrCreateTag().getInt("ammo") - 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ public class MarlinWuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure {
|
||||||
if (entity == null)
|
if (entity == null)
|
||||||
return;
|
return;
|
||||||
double id = itemstack.getOrCreateTag().getDouble("id");
|
double id = itemstack.getOrCreateTag().getDouble("id");
|
||||||
itemstack.getOrCreateTag().getDouble("ammo");
|
itemstack.getOrCreateTag().getInt("ammo");
|
||||||
if ((entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") != itemstack.getOrCreateTag().getDouble("id")) {
|
if ((entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") != itemstack.getOrCreateTag().getDouble("id")) {
|
||||||
itemstack.getOrCreateTag().putDouble("finish", 0);
|
itemstack.getOrCreateTag().putDouble("finish", 0);
|
||||||
itemstack.getOrCreateTag().putDouble("reloading", 0);
|
itemstack.getOrCreateTag().putDouble("reloading", 0);
|
||||||
|
@ -37,7 +37,7 @@ public class MarlinWuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure {
|
||||||
}
|
}
|
||||||
if (itemstack.getOrCreateTag().getDouble("reloading") == 1 && (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
if (itemstack.getOrCreateTag().getDouble("reloading") == 1 && (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
||||||
if (itemstack.getOrCreateTag().getDouble("prepare") == 0 && itemstack.getOrCreateTag().getDouble("loading") == 0
|
if (itemstack.getOrCreateTag().getDouble("prepare") == 0 && itemstack.getOrCreateTag().getDouble("loading") == 0
|
||||||
&& !(itemstack.getOrCreateTag().getDouble("ammo") >= 8 || (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).rifleAmmo == 0)) {
|
&& !(itemstack.getOrCreateTag().getInt("ammo") >= 8 || (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).rifleAmmo == 0)) {
|
||||||
if (itemstack.getOrCreateTag().getDouble("forcestop") == 1) {
|
if (itemstack.getOrCreateTag().getDouble("forcestop") == 1) {
|
||||||
itemstack.getOrCreateTag().putDouble("stop", 1);
|
itemstack.getOrCreateTag().putDouble("stop", 1);
|
||||||
} else {
|
} else {
|
||||||
|
@ -58,16 +58,16 @@ public class MarlinWuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (itemstack.getOrCreateTag().getDouble("loading") == 9) {
|
if (itemstack.getOrCreateTag().getDouble("loading") == 9) {
|
||||||
itemstack.getOrCreateTag().putDouble("ammo", (itemstack.getOrCreateTag().getDouble("ammo") + 1));
|
itemstack.getOrCreateTag().putInt("ammo", (itemstack.getOrCreateTag().getInt("ammo") + 1));
|
||||||
{
|
{
|
||||||
double _setval = (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).rifleAmmo - 1;
|
int _setval = (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).rifleAmmo - 1;
|
||||||
entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> {
|
entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> {
|
||||||
capability.rifleAmmo = _setval;
|
capability.rifleAmmo = _setval;
|
||||||
capability.syncPlayerVariables(entity);
|
capability.syncPlayerVariables(entity);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((itemstack.getOrCreateTag().getDouble("ammo") >= 8 || (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).rifleAmmo == 0)
|
if ((itemstack.getOrCreateTag().getInt("ammo") >= 8 || (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).rifleAmmo == 0)
|
||||||
&& itemstack.getOrCreateTag().getDouble("loading") == 0 || itemstack.getOrCreateTag().getDouble("stop") == 1) {
|
&& itemstack.getOrCreateTag().getDouble("loading") == 0 || itemstack.getOrCreateTag().getDouble("stop") == 1) {
|
||||||
itemstack.getOrCreateTag().putDouble("forcestop", 0);
|
itemstack.getOrCreateTag().putDouble("forcestop", 0);
|
||||||
itemstack.getOrCreateTag().putDouble("stop", 0);
|
itemstack.getOrCreateTag().putDouble("stop", 0);
|
||||||
|
|
|
@ -14,11 +14,11 @@ public class MarlinfireProcedure {
|
||||||
if (player.isSpectator()) return;
|
if (player.isSpectator()) return;
|
||||||
|
|
||||||
ItemStack usehand = player.getMainHandItem();
|
ItemStack usehand = player.getMainHandItem();
|
||||||
if (usehand.getOrCreateTag().getDouble("reloading") == 1 && usehand.getOrCreateTag().getDouble("prepare") == 0 && usehand.getOrCreateTag().getDouble("ammo") > 0) {
|
if (usehand.getOrCreateTag().getDouble("reloading") == 1 && usehand.getOrCreateTag().getDouble("prepare") == 0 && usehand.getOrCreateTag().getInt("ammo") > 0) {
|
||||||
usehand.getOrCreateTag().putDouble("forcestop", 1);
|
usehand.getOrCreateTag().putDouble("forcestop", 1);
|
||||||
}
|
}
|
||||||
if (usehand.getItem() == TargetModItems.MARLIN.get() && usehand.getOrCreateTag().getDouble("reloading") == 0 && !player.getCooldowns().isOnCooldown(usehand.getItem())
|
if (usehand.getItem() == TargetModItems.MARLIN.get() && usehand.getOrCreateTag().getDouble("reloading") == 0 && !player.getCooldowns().isOnCooldown(usehand.getItem())
|
||||||
&& usehand.getOrCreateTag().getDouble("ammo") > 0) {
|
&& usehand.getOrCreateTag().getInt("ammo") > 0) {
|
||||||
if ((player.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).zooming) {
|
if ((player.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).zooming) {
|
||||||
player.getCooldowns().addCooldown(usehand.getItem(), 15);
|
player.getCooldowns().addCooldown(usehand.getItem(), 15);
|
||||||
usehand.getOrCreateTag().putDouble("firing", 15);
|
usehand.getOrCreateTag().putDouble("firing", 15);
|
||||||
|
@ -40,7 +40,7 @@ public class MarlinfireProcedure {
|
||||||
player.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, player.position(), player.getRotationVector(), (ServerLevel) player.level(), 4,
|
player.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, player.position(), player.getRotationVector(), (ServerLevel) player.level(), 4,
|
||||||
player.getName().getString(), player.getDisplayName(), player.level().getServer(), player), "playsound target:marlin_veryfar player @a ~ ~ ~ 24 1");
|
player.getName().getString(), player.getDisplayName(), player.level().getServer(), player), "playsound target:marlin_veryfar player @a ~ ~ ~ 24 1");
|
||||||
}
|
}
|
||||||
usehand.getOrCreateTag().putDouble("ammo", (usehand.getOrCreateTag().getDouble("ammo") - 1));
|
usehand.getOrCreateTag().putInt("ammo", (usehand.getOrCreateTag().getInt("ammo") - 1));
|
||||||
if (usehand.getOrCreateTag().getDouble("animindex") == 1) {
|
if (usehand.getOrCreateTag().getDouble("animindex") == 1) {
|
||||||
usehand.getOrCreateTag().putDouble("animindex", 0);
|
usehand.getOrCreateTag().putDouble("animindex", 0);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -20,7 +20,7 @@ public class Mk14WuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure {
|
||||||
itemstack.getOrCreateTag().putDouble("reloading", 0);
|
itemstack.getOrCreateTag().putDouble("reloading", 0);
|
||||||
itemstack.getOrCreateTag().putDouble("reloadtime", 0);
|
itemstack.getOrCreateTag().putDouble("reloadtime", 0);
|
||||||
}
|
}
|
||||||
if (itemstack.getOrCreateTag().getDouble("reloading") == 1 && itemstack.getOrCreateTag().getDouble("ammo") == 0) {
|
if (itemstack.getOrCreateTag().getDouble("reloading") == 1 && itemstack.getOrCreateTag().getInt("ammo") == 0) {
|
||||||
if (itemstack.getOrCreateTag().getDouble("reloadtime") == 55) {
|
if (itemstack.getOrCreateTag().getDouble("reloadtime") == 55) {
|
||||||
entity.getPersistentData().putDouble("id", id);
|
entity.getPersistentData().putDouble("id", id);
|
||||||
{
|
{
|
||||||
|
@ -46,7 +46,7 @@ public class Mk14WuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure {
|
||||||
if (itemstack.getOrCreateTag().getDouble("reloadtime") == 1 && (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
if (itemstack.getOrCreateTag().getDouble("reloadtime") == 1 && (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
||||||
GunReload.reload(entity, GunInfo.Type.RIFLE);
|
GunReload.reload(entity, GunInfo.Type.RIFLE);
|
||||||
}
|
}
|
||||||
} else if (itemstack.getOrCreateTag().getDouble("reloading") == 1 && itemstack.getOrCreateTag().getDouble("ammo") > 0) {
|
} else if (itemstack.getOrCreateTag().getDouble("reloading") == 1 && itemstack.getOrCreateTag().getInt("ammo") > 0) {
|
||||||
if (itemstack.getOrCreateTag().getDouble("reloadtime") == 45) {
|
if (itemstack.getOrCreateTag().getDouble("reloadtime") == 45) {
|
||||||
entity.getPersistentData().putDouble("id", id);
|
entity.getPersistentData().putDouble("id", id);
|
||||||
{
|
{
|
||||||
|
|
|
@ -21,8 +21,8 @@ public class PlayerReloadProcedure {
|
||||||
if (player.getMainHandItem().getItem() == TargetModItems.TASER.get()
|
if (player.getMainHandItem().getItem() == TargetModItems.TASER.get()
|
||||||
&& !(player.getCooldowns().isOnCooldown(player.getMainHandItem().getItem()))
|
&& !(player.getCooldowns().isOnCooldown(player.getMainHandItem().getItem()))
|
||||||
&& tag.getDouble("reloading") == 0
|
&& tag.getDouble("reloading") == 0
|
||||||
&& tag.getDouble("ammo") < 1
|
&& tag.getInt("ammo") < 1
|
||||||
&& tag.getDouble("maxammo") > 0) {
|
&& tag.getInt("maxammo") > 0) {
|
||||||
tag.putDouble("reloading", 1);
|
tag.putDouble("reloading", 1);
|
||||||
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
||||||
tag.putDouble("reloadtime", 55);
|
tag.putDouble("reloadtime", 55);
|
||||||
|
@ -30,7 +30,7 @@ public class PlayerReloadProcedure {
|
||||||
if (player.getMainHandItem().getItem() == TargetModItems.TRACHELIUM.get()
|
if (player.getMainHandItem().getItem() == TargetModItems.TRACHELIUM.get()
|
||||||
&& !(player.getCooldowns().isOnCooldown(player.getMainHandItem().getItem()))
|
&& !(player.getCooldowns().isOnCooldown(player.getMainHandItem().getItem()))
|
||||||
&& tag.getDouble("reloading") == 0
|
&& tag.getDouble("reloading") == 0
|
||||||
&& tag.getDouble("ammo") < 8
|
&& tag.getInt("ammo") < 8
|
||||||
&& (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).handgunAmmo > 0) {
|
&& (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).handgunAmmo > 0) {
|
||||||
tag.putDouble("reloading", 1);
|
tag.putDouble("reloading", 1);
|
||||||
tag.putDouble("emptyreload", 1);
|
tag.putDouble("emptyreload", 1);
|
||||||
|
@ -40,7 +40,7 @@ public class PlayerReloadProcedure {
|
||||||
if (player.getMainHandItem().getItem() == TargetModItems.HUNTING_RIFLE.get()
|
if (player.getMainHandItem().getItem() == TargetModItems.HUNTING_RIFLE.get()
|
||||||
&& !(player.getCooldowns().isOnCooldown(player.getMainHandItem().getItem()))
|
&& !(player.getCooldowns().isOnCooldown(player.getMainHandItem().getItem()))
|
||||||
&& tag.getDouble("reloading") == 0
|
&& tag.getDouble("reloading") == 0
|
||||||
&& tag.getDouble("ammo") < 1
|
&& tag.getInt("ammo") < 1
|
||||||
&& (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).sniperAmmo > 0) {
|
&& (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).sniperAmmo > 0) {
|
||||||
tag.putDouble("reloading", 1);
|
tag.putDouble("reloading", 1);
|
||||||
tag.putDouble("reloadtime", 61);
|
tag.putDouble("reloadtime", 61);
|
||||||
|
@ -50,8 +50,8 @@ public class PlayerReloadProcedure {
|
||||||
if (player.getMainHandItem().getItem() == TargetModItems.M_79.get()
|
if (player.getMainHandItem().getItem() == TargetModItems.M_79.get()
|
||||||
&& !(player.getCooldowns().isOnCooldown(player.getMainHandItem().getItem()))
|
&& !(player.getCooldowns().isOnCooldown(player.getMainHandItem().getItem()))
|
||||||
&& tag.getDouble("reloading") == 0
|
&& tag.getDouble("reloading") == 0
|
||||||
&& tag.getDouble("ammo") < 1
|
&& tag.getInt("ammo") < 1
|
||||||
&& tag.getDouble("maxammo") > 0) {
|
&& tag.getInt("maxammo") > 0) {
|
||||||
tag.putDouble("reloading", 1);
|
tag.putDouble("reloading", 1);
|
||||||
tag.putDouble("emptyreload", 1);
|
tag.putDouble("emptyreload", 1);
|
||||||
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
||||||
|
@ -60,8 +60,8 @@ public class PlayerReloadProcedure {
|
||||||
if (player.getMainHandItem().getItem() == TargetModItems.RPG.get()
|
if (player.getMainHandItem().getItem() == TargetModItems.RPG.get()
|
||||||
&& !(player.getCooldowns().isOnCooldown(player.getMainHandItem().getItem()))
|
&& !(player.getCooldowns().isOnCooldown(player.getMainHandItem().getItem()))
|
||||||
&& tag.getDouble("reloading") == 0
|
&& tag.getDouble("reloading") == 0
|
||||||
&& tag.getDouble("ammo") < 1
|
&& tag.getInt("ammo") < 1
|
||||||
&& tag.getDouble("maxammo") > 0) {
|
&& tag.getInt("maxammo") > 0) {
|
||||||
tag.putDouble("reloading", 1);
|
tag.putDouble("reloading", 1);
|
||||||
tag.putDouble("emptyreload", 1);
|
tag.putDouble("emptyreload", 1);
|
||||||
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
||||||
|
@ -70,14 +70,14 @@ public class PlayerReloadProcedure {
|
||||||
if (player.getMainHandItem().getItem() == TargetModItems.ABEKIRI.get()
|
if (player.getMainHandItem().getItem() == TargetModItems.ABEKIRI.get()
|
||||||
&& !(player.getCooldowns().isOnCooldown(player.getMainHandItem().getItem()))
|
&& !(player.getCooldowns().isOnCooldown(player.getMainHandItem().getItem()))
|
||||||
&& tag.getDouble("reloading") == 0
|
&& tag.getDouble("reloading") == 0
|
||||||
&& tag.getDouble("ammo") < 2
|
&& tag.getInt("ammo") < 2
|
||||||
&& (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).shotgunAmmo > 0) {
|
&& (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).shotgunAmmo > 0) {
|
||||||
if (tag.getDouble("ammo") == 1) {
|
if (tag.getInt("ammo") == 1) {
|
||||||
tag.putDouble("reloading", 1);
|
tag.putDouble("reloading", 1);
|
||||||
tag.putDouble("emptyreload", 0);
|
tag.putDouble("emptyreload", 0);
|
||||||
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
||||||
tag.putDouble("reloadtime", 83);
|
tag.putDouble("reloadtime", 83);
|
||||||
} else if (tag.getDouble("ammo") == 0) {
|
} else if (tag.getInt("ammo") == 0) {
|
||||||
tag.putDouble("reloading", 1);
|
tag.putDouble("reloading", 1);
|
||||||
tag.putDouble("emptyreload", 1);
|
tag.putDouble("emptyreload", 1);
|
||||||
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
||||||
|
@ -87,14 +87,14 @@ public class PlayerReloadProcedure {
|
||||||
if (player.getMainHandItem().getItem() == TargetModItems.M_98B.get()
|
if (player.getMainHandItem().getItem() == TargetModItems.M_98B.get()
|
||||||
&& !(player.getCooldowns().isOnCooldown(player.getMainHandItem().getItem()))
|
&& !(player.getCooldowns().isOnCooldown(player.getMainHandItem().getItem()))
|
||||||
&& tag.getDouble("reloading") == 0
|
&& tag.getDouble("reloading") == 0
|
||||||
&& tag.getDouble("ammo") < 6
|
&& tag.getInt("ammo") < 6
|
||||||
&& (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).sniperAmmo > 0) {
|
&& (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).sniperAmmo > 0) {
|
||||||
if (tag.getDouble("ammo") > 0) {
|
if (tag.getInt("ammo") > 0) {
|
||||||
tag.putDouble("reloading", 1);
|
tag.putDouble("reloading", 1);
|
||||||
tag.putDouble("emptyreload", 0);
|
tag.putDouble("emptyreload", 0);
|
||||||
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
||||||
tag.putDouble("reloadtime", 57);
|
tag.putDouble("reloadtime", 57);
|
||||||
} else if (tag.getDouble("ammo") == 0) {
|
} else if (tag.getInt("ammo") == 0) {
|
||||||
tag.putDouble("reloading", 1);
|
tag.putDouble("reloading", 1);
|
||||||
tag.putDouble("emptyreload", 1);
|
tag.putDouble("emptyreload", 1);
|
||||||
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
||||||
|
@ -104,14 +104,14 @@ public class PlayerReloadProcedure {
|
||||||
if (player.getMainHandItem().getItem() == TargetModItems.KRABER.get()
|
if (player.getMainHandItem().getItem() == TargetModItems.KRABER.get()
|
||||||
&& !(player.getCooldowns().isOnCooldown(player.getMainHandItem().getItem()))
|
&& !(player.getCooldowns().isOnCooldown(player.getMainHandItem().getItem()))
|
||||||
&& tag.getDouble("reloading") == 0
|
&& tag.getDouble("reloading") == 0
|
||||||
&& tag.getDouble("ammo") < 5
|
&& tag.getInt("ammo") < 5
|
||||||
&& (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).sniperAmmo > 0) {
|
&& (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).sniperAmmo > 0) {
|
||||||
if (tag.getDouble("ammo") > 0) {
|
if (tag.getInt("ammo") > 0) {
|
||||||
tag.putDouble("reloading", 1);
|
tag.putDouble("reloading", 1);
|
||||||
tag.putDouble("emptyreload", 0);
|
tag.putDouble("emptyreload", 0);
|
||||||
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
||||||
tag.putDouble("reloadtime", 65);
|
tag.putDouble("reloadtime", 65);
|
||||||
} else if (tag.getDouble("ammo") == 0) {
|
} else if (tag.getInt("ammo") == 0) {
|
||||||
tag.putDouble("reloading", 1);
|
tag.putDouble("reloading", 1);
|
||||||
tag.putDouble("emptyreload", 1);
|
tag.putDouble("emptyreload", 1);
|
||||||
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
||||||
|
@ -121,14 +121,14 @@ public class PlayerReloadProcedure {
|
||||||
if (player.getMainHandItem().getItem() == TargetModItems.VECTOR.get()
|
if (player.getMainHandItem().getItem() == TargetModItems.VECTOR.get()
|
||||||
&& !(player.getCooldowns().isOnCooldown(player.getMainHandItem().getItem()))
|
&& !(player.getCooldowns().isOnCooldown(player.getMainHandItem().getItem()))
|
||||||
&& tag.getDouble("reloading") == 0
|
&& tag.getDouble("reloading") == 0
|
||||||
&& tag.getDouble("ammo") < 34
|
&& tag.getInt("ammo") < 34
|
||||||
&& (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).handgunAmmo > 0) {
|
&& (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).handgunAmmo > 0) {
|
||||||
if (tag.getDouble("ammo") > 0) {
|
if (tag.getInt("ammo") > 0) {
|
||||||
tag.putDouble("reloading", 1);
|
tag.putDouble("reloading", 1);
|
||||||
tag.putDouble("emptyreload", 0);
|
tag.putDouble("emptyreload", 0);
|
||||||
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
||||||
tag.putDouble("reloadtime", 47);
|
tag.putDouble("reloadtime", 47);
|
||||||
} else if (tag.getDouble("ammo") == 0) {
|
} else if (tag.getInt("ammo") == 0) {
|
||||||
tag.putDouble("reloading", 1);
|
tag.putDouble("reloading", 1);
|
||||||
tag.putDouble("emptyreload", 1);
|
tag.putDouble("emptyreload", 1);
|
||||||
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
||||||
|
@ -138,14 +138,14 @@ public class PlayerReloadProcedure {
|
||||||
if (player.getMainHandItem().getItem() == TargetModItems.MK_14.get()
|
if (player.getMainHandItem().getItem() == TargetModItems.MK_14.get()
|
||||||
&& !(player.getCooldowns().isOnCooldown(player.getMainHandItem().getItem()))
|
&& !(player.getCooldowns().isOnCooldown(player.getMainHandItem().getItem()))
|
||||||
&& tag.getDouble("reloading") == 0
|
&& tag.getDouble("reloading") == 0
|
||||||
&& tag.getDouble("ammo") < 21
|
&& tag.getInt("ammo") < 21
|
||||||
&& (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).rifleAmmo > 0) {
|
&& (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).rifleAmmo > 0) {
|
||||||
if (tag.getDouble("ammo") > 0) {
|
if (tag.getInt("ammo") > 0) {
|
||||||
tag.putDouble("reloading", 1);
|
tag.putDouble("reloading", 1);
|
||||||
tag.putDouble("emptyreload", 0);
|
tag.putDouble("emptyreload", 0);
|
||||||
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
||||||
tag.putDouble("reloadtime", 45);
|
tag.putDouble("reloadtime", 45);
|
||||||
} else if (tag.getDouble("ammo") == 0) {
|
} else if (tag.getInt("ammo") == 0) {
|
||||||
tag.putDouble("reloading", 1);
|
tag.putDouble("reloading", 1);
|
||||||
tag.putDouble("emptyreload", 1);
|
tag.putDouble("emptyreload", 1);
|
||||||
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
||||||
|
@ -155,14 +155,14 @@ public class PlayerReloadProcedure {
|
||||||
if (player.getMainHandItem().getItem() == TargetModItems.SKS.get()
|
if (player.getMainHandItem().getItem() == TargetModItems.SKS.get()
|
||||||
&& !(player.getCooldowns().isOnCooldown(player.getMainHandItem().getItem()))
|
&& !(player.getCooldowns().isOnCooldown(player.getMainHandItem().getItem()))
|
||||||
&& tag.getDouble("reloading") == 0
|
&& tag.getDouble("reloading") == 0
|
||||||
&& tag.getDouble("ammo") < 21
|
&& tag.getInt("ammo") < 21
|
||||||
&& (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).rifleAmmo > 0) {
|
&& (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).rifleAmmo > 0) {
|
||||||
if (tag.getDouble("ammo") > 0) {
|
if (tag.getInt("ammo") > 0) {
|
||||||
tag.putDouble("reloading", 1);
|
tag.putDouble("reloading", 1);
|
||||||
tag.putDouble("emptyreload", 0);
|
tag.putDouble("emptyreload", 0);
|
||||||
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
||||||
tag.putDouble("reloadtime", 41);
|
tag.putDouble("reloadtime", 41);
|
||||||
} else if (tag.getDouble("ammo") == 0) {
|
} else if (tag.getInt("ammo") == 0) {
|
||||||
tag.putDouble("reloading", 1);
|
tag.putDouble("reloading", 1);
|
||||||
tag.putDouble("emptyreload", 1);
|
tag.putDouble("emptyreload", 1);
|
||||||
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
||||||
|
@ -172,14 +172,14 @@ public class PlayerReloadProcedure {
|
||||||
if (player.getMainHandItem().getItem() == TargetModItems.AK_47.get()
|
if (player.getMainHandItem().getItem() == TargetModItems.AK_47.get()
|
||||||
&& !(player.getCooldowns().isOnCooldown(player.getMainHandItem().getItem()))
|
&& !(player.getCooldowns().isOnCooldown(player.getMainHandItem().getItem()))
|
||||||
&& tag.getDouble("reloading") == 0
|
&& tag.getDouble("reloading") == 0
|
||||||
&& tag.getDouble("ammo") < 31
|
&& tag.getInt("ammo") < 31
|
||||||
&& (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).rifleAmmo > 0) {
|
&& (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).rifleAmmo > 0) {
|
||||||
if (tag.getDouble("ammo") > 0) {
|
if (tag.getInt("ammo") > 0) {
|
||||||
tag.putDouble("reloading", 1);
|
tag.putDouble("reloading", 1);
|
||||||
tag.putDouble("emptyreload", 0);
|
tag.putDouble("emptyreload", 0);
|
||||||
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
||||||
tag.putDouble("reloadtime", 41);
|
tag.putDouble("reloadtime", 41);
|
||||||
} else if (tag.getDouble("ammo") == 0) {
|
} else if (tag.getInt("ammo") == 0) {
|
||||||
tag.putDouble("reloading", 1);
|
tag.putDouble("reloading", 1);
|
||||||
tag.putDouble("emptyreload", 1);
|
tag.putDouble("emptyreload", 1);
|
||||||
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
||||||
|
@ -190,14 +190,14 @@ public class PlayerReloadProcedure {
|
||||||
|| player.getMainHandItem().getItem() == TargetModItems.HK_416.get())
|
|| player.getMainHandItem().getItem() == TargetModItems.HK_416.get())
|
||||||
&& !(player.getCooldowns().isOnCooldown(player.getMainHandItem().getItem()))
|
&& !(player.getCooldowns().isOnCooldown(player.getMainHandItem().getItem()))
|
||||||
&& tag.getDouble("reloading") == 0
|
&& tag.getDouble("reloading") == 0
|
||||||
&& tag.getDouble("ammo") < 31
|
&& tag.getInt("ammo") < 31
|
||||||
&& (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).rifleAmmo > 0) {
|
&& (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).rifleAmmo > 0) {
|
||||||
if (tag.getDouble("ammo") > 0) {
|
if (tag.getInt("ammo") > 0) {
|
||||||
tag.putDouble("reloading", 1);
|
tag.putDouble("reloading", 1);
|
||||||
tag.putDouble("emptyreload", 0);
|
tag.putDouble("emptyreload", 0);
|
||||||
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
||||||
tag.putDouble("reloadtime", 41);
|
tag.putDouble("reloadtime", 41);
|
||||||
} else if (tag.getDouble("ammo") == 0) {
|
} else if (tag.getInt("ammo") == 0) {
|
||||||
tag.putDouble("reloading", 1);
|
tag.putDouble("reloading", 1);
|
||||||
tag.putDouble("emptyreload", 1);
|
tag.putDouble("emptyreload", 1);
|
||||||
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
||||||
|
@ -207,14 +207,14 @@ public class PlayerReloadProcedure {
|
||||||
if (player.getMainHandItem().getItem() == TargetModItems.AA_12.get()
|
if (player.getMainHandItem().getItem() == TargetModItems.AA_12.get()
|
||||||
&& !(player.getCooldowns().isOnCooldown(player.getMainHandItem().getItem()))
|
&& !(player.getCooldowns().isOnCooldown(player.getMainHandItem().getItem()))
|
||||||
&& tag.getDouble("reloading") == 0
|
&& tag.getDouble("reloading") == 0
|
||||||
&& tag.getDouble("ammo") < 26
|
&& tag.getInt("ammo") < 26
|
||||||
&& (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).shotgunAmmo > 0) {
|
&& (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).shotgunAmmo > 0) {
|
||||||
if (tag.getDouble("ammo") > 0) {
|
if (tag.getInt("ammo") > 0) {
|
||||||
tag.putDouble("reloading", 1);
|
tag.putDouble("reloading", 1);
|
||||||
tag.putDouble("emptyreload", 0);
|
tag.putDouble("emptyreload", 0);
|
||||||
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
||||||
tag.putDouble("reloadtime", 44);
|
tag.putDouble("reloadtime", 44);
|
||||||
} else if (tag.getDouble("ammo") == 0) {
|
} else if (tag.getInt("ammo") == 0) {
|
||||||
tag.putDouble("reloading", 1);
|
tag.putDouble("reloading", 1);
|
||||||
tag.putDouble("emptyreload", 1);
|
tag.putDouble("emptyreload", 1);
|
||||||
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
||||||
|
@ -225,13 +225,13 @@ public class PlayerReloadProcedure {
|
||||||
&& !(player.getCooldowns().isOnCooldown(player.getMainHandItem().getItem()))
|
&& !(player.getCooldowns().isOnCooldown(player.getMainHandItem().getItem()))
|
||||||
&& tag.getDouble("reloading") == 0
|
&& tag.getDouble("reloading") == 0
|
||||||
&& (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).rifleAmmo > 0
|
&& (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).rifleAmmo > 0
|
||||||
&& tag.getDouble("ammo") < 56) {
|
&& tag.getInt("ammo") < 56) {
|
||||||
if (tag.getDouble("ammo") > 0) {
|
if (tag.getInt("ammo") > 0) {
|
||||||
tag.putDouble("reloading", 1);
|
tag.putDouble("reloading", 1);
|
||||||
tag.putDouble("emptyreload", 0);
|
tag.putDouble("emptyreload", 0);
|
||||||
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
||||||
tag.putDouble("reloadtime", 51);
|
tag.putDouble("reloadtime", 51);
|
||||||
} else if (tag.getDouble("ammo") == 0) {
|
} else if (tag.getInt("ammo") == 0) {
|
||||||
tag.putDouble("reloading", 1);
|
tag.putDouble("reloading", 1);
|
||||||
tag.putDouble("emptyreload", 1);
|
tag.putDouble("emptyreload", 1);
|
||||||
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
||||||
|
@ -242,13 +242,13 @@ public class PlayerReloadProcedure {
|
||||||
&& !(player.getCooldowns().isOnCooldown(player.getMainHandItem().getItem()))
|
&& !(player.getCooldowns().isOnCooldown(player.getMainHandItem().getItem()))
|
||||||
&& tag.getDouble("reloading") == 0
|
&& tag.getDouble("reloading") == 0
|
||||||
&& (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).rifleAmmo > 0
|
&& (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).rifleAmmo > 0
|
||||||
&& tag.getDouble("ammo") < 76) {
|
&& tag.getInt("ammo") < 76) {
|
||||||
if (tag.getDouble("ammo") > 0) {
|
if (tag.getInt("ammo") > 0) {
|
||||||
tag.putDouble("reloading", 1);
|
tag.putDouble("reloading", 1);
|
||||||
tag.putDouble("emptyreload", 0);
|
tag.putDouble("emptyreload", 0);
|
||||||
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
||||||
tag.putDouble("reloadtime", 66);
|
tag.putDouble("reloadtime", 66);
|
||||||
} else if (tag.getDouble("ammo") == 0) {
|
} else if (tag.getInt("ammo") == 0) {
|
||||||
tag.putDouble("reloading", 1);
|
tag.putDouble("reloading", 1);
|
||||||
tag.putDouble("emptyreload", 1);
|
tag.putDouble("emptyreload", 1);
|
||||||
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
||||||
|
@ -258,14 +258,14 @@ public class PlayerReloadProcedure {
|
||||||
if (player.getMainHandItem().getItem() == TargetModItems.SENTINEL.get()
|
if (player.getMainHandItem().getItem() == TargetModItems.SENTINEL.get()
|
||||||
&& !(player.getCooldowns().isOnCooldown(player.getMainHandItem().getItem()))
|
&& !(player.getCooldowns().isOnCooldown(player.getMainHandItem().getItem()))
|
||||||
&& tag.getDouble("reloading") == 0
|
&& tag.getDouble("reloading") == 0
|
||||||
&& tag.getDouble("ammo") < 6
|
&& tag.getInt("ammo") < 6
|
||||||
&& (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).sniperAmmo > 0) {
|
&& (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).sniperAmmo > 0) {
|
||||||
if (tag.getDouble("ammo") > 0) {
|
if (tag.getInt("ammo") > 0) {
|
||||||
tag.putDouble("reloading", 1);
|
tag.putDouble("reloading", 1);
|
||||||
tag.putDouble("emptyreload", 0);
|
tag.putDouble("emptyreload", 0);
|
||||||
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
||||||
tag.putDouble("reloadtime", 53);
|
tag.putDouble("reloadtime", 53);
|
||||||
} else if (tag.getDouble("ammo") == 0) {
|
} else if (tag.getInt("ammo") == 0) {
|
||||||
tag.putDouble("reloading", 1);
|
tag.putDouble("reloading", 1);
|
||||||
tag.putDouble("emptyreload", 1);
|
tag.putDouble("emptyreload", 1);
|
||||||
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
||||||
|
@ -275,14 +275,14 @@ public class PlayerReloadProcedure {
|
||||||
if (player.getMainHandItem().getItem() == TargetModItems.SVD.get()
|
if (player.getMainHandItem().getItem() == TargetModItems.SVD.get()
|
||||||
&& !(player.getCooldowns().isOnCooldown(player.getMainHandItem().getItem()))
|
&& !(player.getCooldowns().isOnCooldown(player.getMainHandItem().getItem()))
|
||||||
&& tag.getDouble("reloading") == 0
|
&& tag.getDouble("reloading") == 0
|
||||||
&& tag.getDouble("ammo") < 11
|
&& tag.getInt("ammo") < 11
|
||||||
&& (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).sniperAmmo > 0) {
|
&& (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).sniperAmmo > 0) {
|
||||||
if (tag.getDouble("ammo") > 0) {
|
if (tag.getInt("ammo") > 0) {
|
||||||
tag.putDouble("reloading", 1);
|
tag.putDouble("reloading", 1);
|
||||||
tag.putDouble("emptyreload", 0);
|
tag.putDouble("emptyreload", 0);
|
||||||
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
||||||
tag.putDouble("reloadtime", 55);
|
tag.putDouble("reloadtime", 55);
|
||||||
} else if (tag.getDouble("ammo") == 0) {
|
} else if (tag.getInt("ammo") == 0) {
|
||||||
tag.putDouble("reloading", 1);
|
tag.putDouble("reloading", 1);
|
||||||
tag.putDouble("emptyreload", 1);
|
tag.putDouble("emptyreload", 1);
|
||||||
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
||||||
|
@ -293,13 +293,13 @@ public class PlayerReloadProcedure {
|
||||||
&& !(player.getCooldowns().isOnCooldown(player.getMainHandItem().getItem()))
|
&& !(player.getCooldowns().isOnCooldown(player.getMainHandItem().getItem()))
|
||||||
&& tag.getDouble("reloading") == 0
|
&& tag.getDouble("reloading") == 0
|
||||||
&& (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).rifleAmmo > 0
|
&& (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).rifleAmmo > 0
|
||||||
&& tag.getDouble("ammo") < 100) {
|
&& tag.getInt("ammo") < 100) {
|
||||||
if (tag.getDouble("ammo") > 0) {
|
if (tag.getInt("ammo") > 0) {
|
||||||
tag.putDouble("reloading", 1);
|
tag.putDouble("reloading", 1);
|
||||||
tag.putDouble("emptyreload", 0);
|
tag.putDouble("emptyreload", 0);
|
||||||
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
||||||
tag.putDouble("reloadtime", 111);
|
tag.putDouble("reloadtime", 111);
|
||||||
} else if (tag.getDouble("ammo") == 0) {
|
} else if (tag.getInt("ammo") == 0) {
|
||||||
tag.putDouble("reloading", 1);
|
tag.putDouble("reloading", 1);
|
||||||
tag.putDouble("emptyreload", 1);
|
tag.putDouble("emptyreload", 1);
|
||||||
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
||||||
|
@ -309,7 +309,7 @@ public class PlayerReloadProcedure {
|
||||||
if (player.getMainHandItem().getItem() == TargetModItems.MARLIN.get()
|
if (player.getMainHandItem().getItem() == TargetModItems.MARLIN.get()
|
||||||
&& !(player.getCooldowns().isOnCooldown(player.getMainHandItem().getItem()))
|
&& !(player.getCooldowns().isOnCooldown(player.getMainHandItem().getItem()))
|
||||||
&& tag.getDouble("reloading") == 0
|
&& tag.getDouble("reloading") == 0
|
||||||
&& tag.getDouble("ammo") < 8
|
&& tag.getInt("ammo") < 8
|
||||||
&& (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).rifleAmmo > 0) {
|
&& (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).rifleAmmo > 0) {
|
||||||
tag.putDouble("reloading", 1);
|
tag.putDouble("reloading", 1);
|
||||||
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
||||||
|
@ -323,9 +323,9 @@ public class PlayerReloadProcedure {
|
||||||
if (player.getMainHandItem().getItem() == TargetModItems.M_870.get()
|
if (player.getMainHandItem().getItem() == TargetModItems.M_870.get()
|
||||||
&& !(player.getCooldowns().isOnCooldown(player.getMainHandItem().getItem()))
|
&& !(player.getCooldowns().isOnCooldown(player.getMainHandItem().getItem()))
|
||||||
&& tag.getDouble("reloading") == 0
|
&& tag.getDouble("reloading") == 0
|
||||||
&& tag.getDouble("ammo") < 8
|
&& tag.getInt("ammo") < 8
|
||||||
&& (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).shotgunAmmo > 0) {
|
&& (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).shotgunAmmo > 0) {
|
||||||
if (tag.getDouble("ammo") == 0) {
|
if (tag.getInt("ammo") == 0) {
|
||||||
tag.putDouble("emptyreload", 1);
|
tag.putDouble("emptyreload", 1);
|
||||||
tag.putDouble("reloading", 1);
|
tag.putDouble("reloading", 1);
|
||||||
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
||||||
|
|
|
@ -28,7 +28,7 @@ public class PressFireProcedure {
|
||||||
if (mainHandItem.is(TargetModTags.Items.GUN)
|
if (mainHandItem.is(TargetModTags.Items.GUN)
|
||||||
&& !(mainHandItem.getItem() == TargetModItems.BOCEK.get())
|
&& !(mainHandItem.getItem() == TargetModItems.BOCEK.get())
|
||||||
&& !(mainHandItem.getItem() == TargetModItems.MINIGUN.get())
|
&& !(mainHandItem.getItem() == TargetModItems.MINIGUN.get())
|
||||||
&& tag.getDouble("ammo") == 0
|
&& tag.getInt("ammo") == 0
|
||||||
&& tag.getDouble("reloading") != 1) {
|
&& tag.getDouble("reloading") != 1) {
|
||||||
if (!player.level().isClientSide() && player.getServer() != null) {
|
if (!player.level().isClientSide() && player.getServer() != null) {
|
||||||
player.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, player.position(), player.getRotationVector(), (ServerLevel) player.level(), 4,
|
player.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, player.position(), player.getRotationVector(), (ServerLevel) player.level(), 4,
|
||||||
|
@ -46,7 +46,7 @@ public class PressFireProcedure {
|
||||||
capability.bowPullHold = true;
|
capability.bowPullHold = true;
|
||||||
capability.syncPlayerVariables(player);
|
capability.syncPlayerVariables(player);
|
||||||
});
|
});
|
||||||
if (tag.getDouble("ammo") == 0) {
|
if (tag.getInt("ammo") == 0) {
|
||||||
PlayerReloadProcedure.execute(player);
|
PlayerReloadProcedure.execute(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ public class RpgFireProcedure {
|
||||||
CompoundTag tag = mainHandItem.getOrCreateTag();
|
CompoundTag tag = mainHandItem.getOrCreateTag();
|
||||||
|
|
||||||
if (mainHandItem.getItem() == TargetModItems.RPG.get() && tag.getDouble("reloading") == 0 && !player.getCooldowns().isOnCooldown(mainHandItem.getItem())
|
if (mainHandItem.getItem() == TargetModItems.RPG.get() && tag.getDouble("reloading") == 0 && !player.getCooldowns().isOnCooldown(mainHandItem.getItem())
|
||||||
&& tag.getDouble("ammo") > 0) {
|
&& tag.getInt("ammo") > 0) {
|
||||||
player.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> {
|
player.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> {
|
||||||
capability.recoilHorizon = Math.random() < 0.5 ? -1 : 1;
|
capability.recoilHorizon = Math.random() < 0.5 ? -1 : 1;
|
||||||
capability.recoil = 0.1;
|
capability.recoil = 0.1;
|
||||||
|
@ -50,7 +50,7 @@ public class RpgFireProcedure {
|
||||||
("particle minecraft:cloud" + (" " + (player.getX() + 1.8 * player.getLookAngle().x)) + (" " + (player.getY() + player.getBbHeight() - 0.1 + 1.8 * player.getLookAngle().y))
|
("particle minecraft:cloud" + (" " + (player.getX() + 1.8 * player.getLookAngle().x)) + (" " + (player.getY() + player.getBbHeight() - 0.1 + 1.8 * player.getLookAngle().y))
|
||||||
+ (" " + (player.getZ() + 1.8 * player.getLookAngle().z)) + " 0.4 0.4 0.4 0.005 30 force @s"));
|
+ (" " + (player.getZ() + 1.8 * player.getLookAngle().z)) + " 0.4 0.4 0.4 0.005 30 force @s"));
|
||||||
}
|
}
|
||||||
if (tag.getDouble("ammo") == 1) {
|
if (tag.getInt("ammo") == 1) {
|
||||||
tag.putDouble("empty", 1);
|
tag.putDouble("empty", 1);
|
||||||
}
|
}
|
||||||
player.getCooldowns().addCooldown(mainHandItem.getItem(), 10);
|
player.getCooldowns().addCooldown(mainHandItem.getItem(), 10);
|
||||||
|
@ -61,7 +61,7 @@ public class RpgFireProcedure {
|
||||||
player.level().playSound(null, player.blockPosition(), TargetModSounds.RPG_VERYFAR.get(), SoundSource.PLAYERS, 16, 1);
|
player.level().playSound(null, player.blockPosition(), TargetModSounds.RPG_VERYFAR.get(), SoundSource.PLAYERS, 16, 1);
|
||||||
}
|
}
|
||||||
tag.putDouble("fireanim", 2);
|
tag.putDouble("fireanim", 2);
|
||||||
tag.putDouble("ammo", tag.getDouble("ammo") - 1);
|
tag.putInt("ammo", tag.getInt("ammo") - 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,8 +42,8 @@ public class RpgWuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure {
|
||||||
tag.putDouble("empty", 0);
|
tag.putDouble("empty", 0);
|
||||||
}
|
}
|
||||||
if (tag.getDouble("reloadtime") == 1 && (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
if (tag.getDouble("reloadtime") == 1 && (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
||||||
if (tag.getDouble("maxammo") >= 0) {
|
if (tag.getInt("maxammo") >= 0) {
|
||||||
tag.putDouble("ammo", 1);
|
tag.putInt("ammo", 1);
|
||||||
if (entity instanceof Player _player) {
|
if (entity instanceof Player _player) {
|
||||||
_player.getInventory().clearOrCountMatchingItems(p -> TargetModItems.ROCKET.get() == p.getItem(), 1, _player.inventoryMenu.getCraftSlots());
|
_player.getInventory().clearOrCountMatchingItems(p -> TargetModItems.ROCKET.get() == p.getItem(), 1, _player.inventoryMenu.getCraftSlots());
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ public class RpkWuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure {
|
||||||
itemstack.getOrCreateTag().putDouble("reloading", 0);
|
itemstack.getOrCreateTag().putDouble("reloading", 0);
|
||||||
itemstack.getOrCreateTag().putDouble("reloadtime", 0);
|
itemstack.getOrCreateTag().putDouble("reloadtime", 0);
|
||||||
}
|
}
|
||||||
if (itemstack.getOrCreateTag().getDouble("reloading") == 1 && itemstack.getOrCreateTag().getDouble("ammo") == 0) {
|
if (itemstack.getOrCreateTag().getDouble("reloading") == 1 && itemstack.getOrCreateTag().getInt("ammo") == 0) {
|
||||||
if (itemstack.getOrCreateTag().getDouble("reloadtime") == 83) {
|
if (itemstack.getOrCreateTag().getDouble("reloadtime") == 83) {
|
||||||
entity.getPersistentData().putDouble("id", id);
|
entity.getPersistentData().putDouble("id", id);
|
||||||
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
||||||
|
@ -39,7 +39,7 @@ public class RpkWuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure {
|
||||||
if (itemstack.getOrCreateTag().getDouble("reloadtime") == 1 && (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
if (itemstack.getOrCreateTag().getDouble("reloadtime") == 1 && (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
||||||
GunReload.reload(entity, GunInfo.Type.RIFLE);
|
GunReload.reload(entity, GunInfo.Type.RIFLE);
|
||||||
}
|
}
|
||||||
} else if (itemstack.getOrCreateTag().getDouble("reloading") == 1 && itemstack.getOrCreateTag().getDouble("ammo") > 0) {
|
} else if (itemstack.getOrCreateTag().getDouble("reloading") == 1 && itemstack.getOrCreateTag().getInt("ammo") > 0) {
|
||||||
if (itemstack.getOrCreateTag().getDouble("reloadtime") == 66) {
|
if (itemstack.getOrCreateTag().getDouble("reloadtime") == 66) {
|
||||||
entity.getPersistentData().putDouble("id", id);
|
entity.getPersistentData().putDouble("id", id);
|
||||||
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
||||||
|
|
|
@ -15,7 +15,7 @@ public class SentinelFireProcedure {
|
||||||
|
|
||||||
ItemStack usehand = player.getMainHandItem();
|
ItemStack usehand = player.getMainHandItem();
|
||||||
if (usehand.getItem() == TargetModItems.SENTINEL.get() && usehand.getOrCreateTag().getDouble("reloading") == 0 && !player.getCooldowns().isOnCooldown(usehand.getItem())
|
if (usehand.getItem() == TargetModItems.SENTINEL.get() && usehand.getOrCreateTag().getDouble("reloading") == 0 && !player.getCooldowns().isOnCooldown(usehand.getItem())
|
||||||
&& usehand.getOrCreateTag().getDouble("ammo") > 0) {
|
&& usehand.getOrCreateTag().getInt("ammo") > 0) {
|
||||||
if (usehand.getOrCreateTag().getDouble("power") > 0) {
|
if (usehand.getOrCreateTag().getDouble("power") > 0) {
|
||||||
if ((player.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).zooming) {
|
if ((player.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).zooming) {
|
||||||
usehand.getOrCreateTag().putDouble("zoomfiring", 24);
|
usehand.getOrCreateTag().putDouble("zoomfiring", 24);
|
||||||
|
@ -57,7 +57,7 @@ public class SentinelFireProcedure {
|
||||||
GunsTool.spawnBullet(player);
|
GunsTool.spawnBullet(player);
|
||||||
usehand.getOrCreateTag().putDouble("crot", 20);
|
usehand.getOrCreateTag().putDouble("crot", 20);
|
||||||
player.getCooldowns().addCooldown(usehand.getItem(), 23);
|
player.getCooldowns().addCooldown(usehand.getItem(), 23);
|
||||||
usehand.getOrCreateTag().putDouble("ammo", (usehand.getOrCreateTag().getDouble("ammo") - 1));
|
usehand.getOrCreateTag().putInt("ammo", (usehand.getOrCreateTag().getInt("ammo") - 1));
|
||||||
usehand.getOrCreateTag().putDouble("fireanim", 2);
|
usehand.getOrCreateTag().putDouble("fireanim", 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ public class SentinelWuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure {
|
||||||
itemstack.getOrCreateTag().putDouble("reloading", 0);
|
itemstack.getOrCreateTag().putDouble("reloading", 0);
|
||||||
itemstack.getOrCreateTag().putDouble("reloadtime", 0);
|
itemstack.getOrCreateTag().putDouble("reloadtime", 0);
|
||||||
}
|
}
|
||||||
if (itemstack.getOrCreateTag().getDouble("reloading") == 1 && itemstack.getOrCreateTag().getDouble("ammo") == 0) {
|
if (itemstack.getOrCreateTag().getDouble("reloading") == 1 && itemstack.getOrCreateTag().getInt("ammo") == 0) {
|
||||||
if (itemstack.getOrCreateTag().getDouble("reloadtime") == 73) {
|
if (itemstack.getOrCreateTag().getDouble("reloadtime") == 73) {
|
||||||
entity.getPersistentData().putDouble("id", id);
|
entity.getPersistentData().putDouble("id", id);
|
||||||
{
|
{
|
||||||
|
@ -45,7 +45,7 @@ public class SentinelWuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure {
|
||||||
if (itemstack.getOrCreateTag().getDouble("reloadtime") == 1 && (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
if (itemstack.getOrCreateTag().getDouble("reloadtime") == 1 && (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
||||||
GunReload.reload(entity, GunInfo.Type.SNIPER);
|
GunReload.reload(entity, GunInfo.Type.SNIPER);
|
||||||
}
|
}
|
||||||
} else if (itemstack.getOrCreateTag().getDouble("reloading") == 1 && itemstack.getOrCreateTag().getDouble("ammo") > 0) {
|
} else if (itemstack.getOrCreateTag().getDouble("reloading") == 1 && itemstack.getOrCreateTag().getInt("ammo") > 0) {
|
||||||
if (itemstack.getOrCreateTag().getDouble("reloadtime") == 53) {
|
if (itemstack.getOrCreateTag().getDouble("reloadtime") == 53) {
|
||||||
entity.getPersistentData().putDouble("id", id);
|
entity.getPersistentData().putDouble("id", id);
|
||||||
{
|
{
|
||||||
|
|
|
@ -20,7 +20,7 @@ public class SksWuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure {
|
||||||
itemstack.getOrCreateTag().putDouble("reloading", 0);
|
itemstack.getOrCreateTag().putDouble("reloading", 0);
|
||||||
itemstack.getOrCreateTag().putDouble("reloadtime", 0);
|
itemstack.getOrCreateTag().putDouble("reloadtime", 0);
|
||||||
}
|
}
|
||||||
if (itemstack.getOrCreateTag().getDouble("reloading") == 1 && itemstack.getOrCreateTag().getDouble("ammo") == 0) {
|
if (itemstack.getOrCreateTag().getDouble("reloading") == 1 && itemstack.getOrCreateTag().getInt("ammo") == 0) {
|
||||||
if (itemstack.getOrCreateTag().getDouble("reloadtime") == 57) {
|
if (itemstack.getOrCreateTag().getDouble("reloadtime") == 57) {
|
||||||
entity.getPersistentData().putDouble("id", id);
|
entity.getPersistentData().putDouble("id", id);
|
||||||
{
|
{
|
||||||
|
@ -47,7 +47,7 @@ public class SksWuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure {
|
||||||
if (itemstack.getOrCreateTag().getDouble("reloadtime") == 1 && (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
if (itemstack.getOrCreateTag().getDouble("reloadtime") == 1 && (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
||||||
GunReload.reload(entity, GunInfo.Type.RIFLE);
|
GunReload.reload(entity, GunInfo.Type.RIFLE);
|
||||||
}
|
}
|
||||||
} else if (itemstack.getOrCreateTag().getDouble("reloading") == 1 && itemstack.getOrCreateTag().getDouble("ammo") > 0) {
|
} else if (itemstack.getOrCreateTag().getDouble("reloading") == 1 && itemstack.getOrCreateTag().getInt("ammo") > 0) {
|
||||||
if (itemstack.getOrCreateTag().getDouble("reloadtime") == 41) {
|
if (itemstack.getOrCreateTag().getDouble("reloadtime") == 41) {
|
||||||
entity.getPersistentData().putDouble("id", id);
|
entity.getPersistentData().putDouble("id", id);
|
||||||
{
|
{
|
||||||
|
|
|
@ -20,7 +20,7 @@ public class SvdWuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure {
|
||||||
itemstack.getOrCreateTag().putDouble("reloading", 0);
|
itemstack.getOrCreateTag().putDouble("reloading", 0);
|
||||||
itemstack.getOrCreateTag().putDouble("reloadtime", 0);
|
itemstack.getOrCreateTag().putDouble("reloadtime", 0);
|
||||||
}
|
}
|
||||||
if (itemstack.getOrCreateTag().getDouble("reloading") == 1 && itemstack.getOrCreateTag().getDouble("ammo") == 0) {
|
if (itemstack.getOrCreateTag().getDouble("reloading") == 1 && itemstack.getOrCreateTag().getInt("ammo") == 0) {
|
||||||
if (itemstack.getOrCreateTag().getDouble("reloadtime") == 66) {
|
if (itemstack.getOrCreateTag().getDouble("reloadtime") == 66) {
|
||||||
entity.getPersistentData().putDouble("id", id);
|
entity.getPersistentData().putDouble("id", id);
|
||||||
{
|
{
|
||||||
|
@ -47,7 +47,7 @@ public class SvdWuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure {
|
||||||
if (itemstack.getOrCreateTag().getDouble("reloadtime") == 1 && (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
if (itemstack.getOrCreateTag().getDouble("reloadtime") == 1 && (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
||||||
GunReload.reload(entity, GunInfo.Type.SNIPER);
|
GunReload.reload(entity, GunInfo.Type.SNIPER);
|
||||||
}
|
}
|
||||||
} else if (itemstack.getOrCreateTag().getDouble("reloading") == 1 && itemstack.getOrCreateTag().getDouble("ammo") > 0) {
|
} else if (itemstack.getOrCreateTag().getDouble("reloading") == 1 && itemstack.getOrCreateTag().getInt("ammo") > 0) {
|
||||||
if (itemstack.getOrCreateTag().getDouble("reloadtime") == 55) {
|
if (itemstack.getOrCreateTag().getDouble("reloadtime") == 55) {
|
||||||
entity.getPersistentData().putDouble("id", id);
|
entity.getPersistentData().putDouble("id", id);
|
||||||
{
|
{
|
||||||
|
|
|
@ -42,8 +42,8 @@ public class TasercooldownProcedure {
|
||||||
itemstack.getOrCreateTag().putDouble("emptyreload", 0);
|
itemstack.getOrCreateTag().putDouble("emptyreload", 0);
|
||||||
}
|
}
|
||||||
if (itemstack.getOrCreateTag().getDouble("reloadtime") == 1 && (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
if (itemstack.getOrCreateTag().getDouble("reloadtime") == 1 && (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
|
||||||
if (itemstack.getOrCreateTag().getDouble("maxammo") >= 1) {
|
if (itemstack.getOrCreateTag().getInt("maxammo") >= 1) {
|
||||||
itemstack.getOrCreateTag().putDouble("ammo", 1);
|
itemstack.getOrCreateTag().putInt("ammo", 1);
|
||||||
if (entity instanceof Player _player) {
|
if (entity instanceof Player _player) {
|
||||||
ItemStack _stktoremove = new ItemStack(TargetModItems.TASER_ELECTRODE.get());
|
ItemStack _stktoremove = new ItemStack(TargetModItems.TASER_ELECTRODE.get());
|
||||||
_player.getInventory().clearOrCountMatchingItems(p -> _stktoremove.getItem() == p.getItem(), 1, _player.inventoryMenu.getCraftSlots());
|
_player.getInventory().clearOrCountMatchingItems(p -> _stktoremove.getItem() == p.getItem(), 1, _player.inventoryMenu.getCraftSlots());
|
||||||
|
|
|
@ -22,7 +22,7 @@ public class TaserfireProcedure {
|
||||||
if (entity instanceof Player player && !player.isSpectator()) {
|
if (entity instanceof Player player && !player.isSpectator()) {
|
||||||
ItemStack usehand = player.getMainHandItem();
|
ItemStack usehand = player.getMainHandItem();
|
||||||
if (usehand.getItem() == TargetModItems.TASER.get() && usehand.getOrCreateTag().getDouble("reloading") == 0 && !(entity instanceof Player _plrCldCheck4 && _plrCldCheck4.getCooldowns().isOnCooldown(usehand.getItem()))
|
if (usehand.getItem() == TargetModItems.TASER.get() && usehand.getOrCreateTag().getDouble("reloading") == 0 && !(entity instanceof Player _plrCldCheck4 && _plrCldCheck4.getCooldowns().isOnCooldown(usehand.getItem()))
|
||||||
&& usehand.getOrCreateTag().getDouble("ammo") > 0) {
|
&& usehand.getOrCreateTag().getInt("ammo") > 0) {
|
||||||
|
|
||||||
entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> {
|
entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> {
|
||||||
capability.recoilHorizon = Math.random() < 0.5 ? -1 : 1;
|
capability.recoilHorizon = Math.random() < 0.5 ? -1 : 1;
|
||||||
|
@ -69,7 +69,7 @@ public class TaserfireProcedure {
|
||||||
projectileLevel.addFreshEntity(_entityToSpawn);
|
projectileLevel.addFreshEntity(_entityToSpawn);
|
||||||
}
|
}
|
||||||
usehand.getOrCreateTag().putDouble("fireanim", 4);
|
usehand.getOrCreateTag().putDouble("fireanim", 4);
|
||||||
usehand.getOrCreateTag().putDouble("ammo", (usehand.getOrCreateTag().getDouble("ammo") - 1));
|
usehand.getOrCreateTag().putInt("ammo", (usehand.getOrCreateTag().getInt("ammo") - 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ public class VectorFireProcedure {
|
||||||
if (mainHandItem.getItem() != TargetModItems.VECTOR.get()) return;
|
if (mainHandItem.getItem() != TargetModItems.VECTOR.get()) return;
|
||||||
|
|
||||||
CompoundTag tag = mainHandItem.getOrCreateTag();
|
CompoundTag tag = mainHandItem.getOrCreateTag();
|
||||||
if (tag.getDouble("firemode") == 1 && tag.getDouble("burst") == 0) {
|
if (tag.getInt("firemode") == 1 && tag.getDouble("burst") == 0) {
|
||||||
tag.putDouble("burst", 3);
|
tag.putDouble("burst", 3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,10 +23,10 @@ public class WeaponDrawProcedure {
|
||||||
});
|
});
|
||||||
if (entity instanceof Player _player)
|
if (entity instanceof Player _player)
|
||||||
_player.getCooldowns().addCooldown(itemStack.getItem(), 16);
|
_player.getCooldowns().addCooldown(itemStack.getItem(), 16);
|
||||||
if (itemStack.getItem() == TargetModItems.RPG.get() && tag.getDouble("ammo") == 0) {
|
if (itemStack.getItem() == TargetModItems.RPG.get() && tag.getInt("ammo") == 0) {
|
||||||
tag.putDouble("empty", 1);
|
tag.putDouble("empty", 1);
|
||||||
}
|
}
|
||||||
if (itemStack.getItem() == TargetModItems.SKS.get() && tag.getDouble("ammo") == 0) {
|
if (itemStack.getItem() == TargetModItems.SKS.get() && tag.getInt("ammo") == 0) {
|
||||||
tag.putDouble("gj", 1);
|
tag.putDouble("gj", 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,13 @@
|
||||||
package net.mcreator.target.procedures;
|
package net.mcreator.target.procedures;
|
||||||
|
|
||||||
|
import net.mcreator.target.init.TargetModItems;
|
||||||
|
import net.mcreator.target.network.TargetModVariables;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
|
import net.minecraft.world.entity.Entity;
|
||||||
|
import net.minecraft.world.entity.LivingEntity;
|
||||||
|
import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.item.Item;
|
import net.minecraft.world.item.Item;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.entity.player.Player;
|
|
||||||
import net.minecraft.world.entity.LivingEntity;
|
|
||||||
import net.minecraft.world.entity.Entity;
|
|
||||||
|
|
||||||
import net.mcreator.target.network.TargetModVariables;
|
|
||||||
import net.mcreator.target.init.TargetModItems;
|
|
||||||
|
|
||||||
public class WeapondrawhaveyProcedure {
|
public class WeapondrawhaveyProcedure {
|
||||||
public static void execute(Entity entity, ItemStack itemStack) {
|
public static void execute(Entity entity, ItemStack itemStack) {
|
||||||
|
@ -24,7 +23,7 @@ public class WeapondrawhaveyProcedure {
|
||||||
});
|
});
|
||||||
if (entity instanceof Player _player)
|
if (entity instanceof Player _player)
|
||||||
_player.getCooldowns().addCooldown(itemStack.getItem(), 29);
|
_player.getCooldowns().addCooldown(itemStack.getItem(), 29);
|
||||||
if (itemStack.getItem() == TargetModItems.M_60.get() && tag.getDouble("ammo") <= 5) {
|
if (itemStack.getItem() == TargetModItems.M_60.get() && tag.getInt("ammo") <= 5) {
|
||||||
tag.putDouble("empty", 1);
|
tag.putDouble("empty", 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,16 +15,16 @@ public class GunReload {
|
||||||
|
|
||||||
CompoundTag tag = living.getMainHandItem().getOrCreateTag();
|
CompoundTag tag = living.getMainHandItem().getOrCreateTag();
|
||||||
|
|
||||||
double mag = tag.getDouble("mag");
|
int mag = tag.getInt("mag");
|
||||||
double ammo = tag.getDouble("ammo");
|
int ammo = tag.getInt("ammo");
|
||||||
double ammoToAdd = mag - ammo + (extraOne ? 1 : 0);
|
int ammoToAdd = mag - ammo + (extraOne ? 1 : 0);
|
||||||
|
|
||||||
double playerAmmo = entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).map(c -> switch (type) {
|
int playerAmmo = entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).map(c -> switch (type) {
|
||||||
case RIFLE -> c.rifleAmmo;
|
case RIFLE -> c.rifleAmmo;
|
||||||
case HANDGUN -> c.handgunAmmo;
|
case HANDGUN -> c.handgunAmmo;
|
||||||
case SHOTGUN -> c.shotgunAmmo;
|
case SHOTGUN -> c.shotgunAmmo;
|
||||||
case SNIPER -> c.sniperAmmo;
|
case SNIPER -> c.sniperAmmo;
|
||||||
}).orElse(0d);
|
}).orElse(0);
|
||||||
|
|
||||||
entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> {
|
entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> {
|
||||||
var newAmmoCount = Math.max(0, playerAmmo - ammoToAdd);
|
var newAmmoCount = Math.max(0, playerAmmo - ammoToAdd);
|
||||||
|
@ -37,7 +37,7 @@ public class GunReload {
|
||||||
|
|
||||||
capability.syncPlayerVariables(entity);
|
capability.syncPlayerVariables(entity);
|
||||||
});
|
});
|
||||||
tag.putDouble("ammo", ammo + Math.min(ammoToAdd, playerAmmo));
|
tag.putInt("ammo", ammo + Math.min(ammoToAdd, playerAmmo));
|
||||||
|
|
||||||
tag.putDouble("reloading", 0);
|
tag.putDouble("reloading", 0);
|
||||||
tag.putDouble("emptyreload", 0);
|
tag.putDouble("emptyreload", 0);
|
||||||
|
|
|
@ -59,7 +59,7 @@ public class GunsTool {
|
||||||
public static void initCreativeGun(ItemStack stack, String location) {
|
public static void initCreativeGun(ItemStack stack, String location) {
|
||||||
if (gunsData != null && gunsData.get(location) != null) {
|
if (gunsData != null && gunsData.get(location) != null) {
|
||||||
gunsData.get(location).forEach((k, v) -> stack.getOrCreateTag().putDouble(k, v));
|
gunsData.get(location).forEach((k, v) -> stack.getOrCreateTag().putDouble(k, v));
|
||||||
stack.getOrCreateTag().putDouble("ammo", stack.getOrCreateTag().getDouble("mag"));
|
stack.getOrCreateTag().putInt("ammo", stack.getOrCreateTag().getInt("mag"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue