@@ -60,37 +60,79 @@ public static float getAttackDamage (LivingEntity user, LivingEntity target) {
60
60
*
61
61
* @param user The wielder of the item.
62
62
* @param target The entity that was struck.
63
+ * @param slot The equipment slot to trigger callbacks for.
63
64
*/
64
65
public static void postChargedHit (LivingEntity user , LivingEntity target , EquipmentSlot slot ) {
65
66
CPCEnchantmentHelper .forEachEnchantment ((enchantment , level ) -> {
66
67
if (enchantment instanceof CPCEnchantment cpcEnchant ) cpcEnchant .postChargedHit (level , user , target );
67
68
}, user , slot );
68
69
}
69
70
71
+ /**
72
+ * Calls enchantment callbacks for charged hits.
73
+ *
74
+ * @param user The wielder of the item.
75
+ * @param target The entity that was struck.
76
+ * @param itemStack The item stack to trigger callbacks for.
77
+ */
78
+ public static void postChargedHit (LivingEntity user , LivingEntity target , ItemStack itemStack ) {
79
+ CPCEnchantmentHelper .forEachEnchantment ((enchantment , level ) -> {
80
+ if (enchantment instanceof CPCEnchantment cpcEnchant ) cpcEnchant .postChargedHit (level , user , target );
81
+ }, itemStack );
82
+ }
83
+
70
84
/**
71
85
* Calls enchantment callbacks for critical hits.
72
86
*
73
87
* @param user The wielder of the item.
74
88
* @param target The entity that was struck.
89
+ * @param slot The equipment slot to trigger callbacks for.
75
90
*/
76
91
public static void postCriticalHit (LivingEntity user , LivingEntity target , EquipmentSlot slot ) {
77
92
CPCEnchantmentHelper .forEachEnchantment ((enchantment , level ) -> {
78
93
if (enchantment instanceof CPCEnchantment cpcEnchant ) cpcEnchant .postCriticalHit (level , user , target );
79
94
}, user , slot );
80
95
}
81
96
97
+ /**
98
+ * Calls enchantment callbacks for critical hits.
99
+ *
100
+ * @param user The wielder of the item.
101
+ * @param target The entity that was struck.
102
+ * @param itemStack The item stack to trigger callbacks for.
103
+ */
104
+ public static void postCriticalHit (LivingEntity user , LivingEntity target , ItemStack itemStack ) {
105
+ CPCEnchantmentHelper .forEachEnchantment ((enchantment , level ) -> {
106
+ if (enchantment instanceof CPCEnchantment cpcEnchant ) cpcEnchant .postCriticalHit (level , user , target );
107
+ }, itemStack );
108
+ }
109
+
82
110
/**
83
111
* Calls enchantment callbacks for kills.
84
112
*
85
113
* @param user The wielder of the item.
86
114
* @param target The entity that was killed.
115
+ * @param slot The equipment slot to trigger callbacks for.
87
116
*/
88
117
public static void postKill (LivingEntity user , LivingEntity target , EquipmentSlot slot ) {
89
118
CPCEnchantmentHelper .forEachEnchantment ((enchantment , level ) -> {
90
119
if (enchantment instanceof CPCEnchantment cpcEnchant ) cpcEnchant .postKill (level , user , target );
91
120
}, user , slot );
92
121
}
93
122
123
+ /**
124
+ * Calls enchantment callbacks for kills.
125
+ *
126
+ * @param user The wielder of the item.
127
+ * @param target The entity that was killed.
128
+ * @param itemStack The item stack to trigger callbacks for.
129
+ */
130
+ public static void postKill (LivingEntity user , LivingEntity target , ItemStack itemStack ) {
131
+ CPCEnchantmentHelper .forEachEnchantment ((enchantment , level ) -> {
132
+ if (enchantment instanceof CPCEnchantment cpcEnchant ) cpcEnchant .postKill (level , user , target );
133
+ }, itemStack );
134
+ }
135
+
94
136
/**
95
137
* Iterates over all equipment slots on the user, activating a consumer for each enchantment.
96
138
*
0 commit comments