Fixes scripts
This commit is contained in:
@@ -33,7 +33,10 @@ echo "[Akarin] Ready to build"
|
|||||||
if [ "$2" == "--fast" ] || [ "$3" == "--fast" ] || [ "$4" == "--fast" ]; then
|
if [ "$2" == "--fast" ] || [ "$3" == "--fast" ] || [ "$4" == "--fast" ]; then
|
||||||
echo "[Akarin] Test has been skipped"
|
echo "[Akarin] Test has been skipped"
|
||||||
mvn clean install -DskipTests
|
mvn clean install -DskipTests
|
||||||
else
|
else
|
||||||
|
rm -rf Paper-API/src
|
||||||
|
rm -rf Paper-Server/src
|
||||||
|
./paper patch
|
||||||
mvn clean install
|
mvn clean install
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
*/
|
*/
|
||||||
package io.akarin.server.mixin.optimization;
|
package io.akarin.server.mixin.optimization;
|
||||||
|
|
||||||
|
import org.spongepowered.asm.mixin.Final;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Overwrite;
|
import org.spongepowered.asm.mixin.Overwrite;
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
@@ -40,51 +41,55 @@ import net.minecraft.server.ItemStack;
|
|||||||
*/
|
*/
|
||||||
@Mixin(value = EnchantmentManager.class, remap = false)
|
@Mixin(value = EnchantmentManager.class, remap = false)
|
||||||
public class WeakEnchantmentManager {
|
public class WeakEnchantmentManager {
|
||||||
|
@Shadow(aliases = "a") @Final private static EnchantmentManager.EnchantmentModifierProtection protection;
|
||||||
|
@Shadow(aliases = "c") @Final private static EnchantmentManager.EnchantmentModifierThorns thorns;
|
||||||
|
@Shadow(aliases = "d") @Final private static EnchantmentManager.EnchantmentModifierArthropods arthropods;
|
||||||
|
|
||||||
@Shadow(aliases = "a") private static void applyEnchantmentModifierArray(EnchantmentManager.EnchantmentModifier modifier, Iterable<ItemStack> iterable) {}
|
@Shadow(aliases = "a") private static void applyEnchantmentModifierArray(EnchantmentManager.EnchantmentModifier modifier, Iterable<ItemStack> iterable) {}
|
||||||
@Shadow(aliases = "a") private static void applyEnchantmentModifier(EnchantmentManager.EnchantmentModifier modifier, ItemStack itemstack) {}
|
@Shadow(aliases = "a") private static void applyEnchantmentModifier(EnchantmentManager.EnchantmentModifier modifier, ItemStack itemstack) {}
|
||||||
|
|
||||||
@Overwrite
|
@Overwrite
|
||||||
public static int a(Iterable<ItemStack> iterable, DamageSource damageSource) {
|
public static int a(Iterable<ItemStack> iterable, DamageSource damageSource) {
|
||||||
EnchantmentManager.a.a = 0; // PAIL: damageModifier
|
protection.a = 0; // PAIL: damageModifier
|
||||||
EnchantmentManager.a.b = damageSource;
|
protection.b = damageSource;
|
||||||
applyEnchantmentModifierArray(EnchantmentManager.a, iterable);
|
applyEnchantmentModifierArray(protection, iterable);
|
||||||
EnchantmentManager.a.b = null; // Akarin - Remove reference to Damagesource
|
protection.b = null; // Akarin - Remove reference to Damagesource
|
||||||
return EnchantmentManager.a.a;
|
return protection.a;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Overwrite
|
@Overwrite
|
||||||
public static void a(EntityLiving user, Entity attacker) { // PAIL: applyThornEnchantments
|
public static void a(EntityLiving user, Entity attacker) { // PAIL: applyThornEnchantments
|
||||||
EnchantmentManager.c.b = attacker;
|
thorns.b = attacker;
|
||||||
EnchantmentManager.c.a = user;
|
thorns.a = user;
|
||||||
if (user != null) {
|
if (user != null) {
|
||||||
applyEnchantmentModifierArray(EnchantmentManager.c, user.aQ()); // PAIL: getEquipmentAndArmor
|
applyEnchantmentModifierArray(thorns, user.aQ()); // PAIL: getEquipmentAndArmor
|
||||||
}
|
}
|
||||||
|
|
||||||
if (attacker instanceof EntityHuman) {
|
if (attacker instanceof EntityHuman) {
|
||||||
applyEnchantmentModifier(EnchantmentManager.c, user.getItemInMainHand());
|
applyEnchantmentModifier(thorns, user.getItemInMainHand());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Akarin Start - remove references to entity objects to avoid memory leaks
|
// Akarin Start - remove references to entity objects to avoid memory leaks
|
||||||
EnchantmentManager.c.b = null;
|
thorns.b = null;
|
||||||
EnchantmentManager.c.a = null;
|
thorns.a = null;
|
||||||
// Akarin end
|
// Akarin end
|
||||||
}
|
}
|
||||||
|
|
||||||
@Overwrite
|
@Overwrite
|
||||||
public static void b(EntityLiving user, Entity target) { // PAIL: applyArthropodEnchantments
|
public static void b(EntityLiving user, Entity target) { // PAIL: applyArthropodEnchantments
|
||||||
EnchantmentManager.d.a = user;
|
arthropods.a = user;
|
||||||
EnchantmentManager.d.b = target;
|
arthropods.b = target;
|
||||||
if (user != null) {
|
if (user != null) {
|
||||||
applyEnchantmentModifierArray(EnchantmentManager.d, user.aQ()); // PAIL: getEquipmentAndArmor
|
applyEnchantmentModifierArray(arthropods, user.aQ()); // PAIL: getEquipmentAndArmor
|
||||||
}
|
}
|
||||||
|
|
||||||
if (user instanceof EntityHuman) {
|
if (user instanceof EntityHuman) {
|
||||||
applyEnchantmentModifier(EnchantmentManager.d, user.getItemInMainHand());
|
applyEnchantmentModifier(arthropods, user.getItemInMainHand());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Akarin Start - remove references to entity objects to avoid memory leaks
|
// Akarin Start - remove references to entity objects to avoid memory leaks
|
||||||
EnchantmentManager.d.a = null;
|
arthropods.a = null;
|
||||||
EnchantmentManager.d.b = null;
|
arthropods.b = null;
|
||||||
// Akarin end
|
// Akarin end
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,10 +18,10 @@ import java.util.Map.Entry;
|
|||||||
*/
|
*/
|
||||||
public class EnchantmentManager {
|
public class EnchantmentManager {
|
||||||
|
|
||||||
public static final EnchantmentManager.EnchantmentModifierProtection a = new EnchantmentManager.EnchantmentModifierProtection(null); // Akarin - private -> public
|
private static final EnchantmentManager.EnchantmentModifierProtection a = new EnchantmentManager.EnchantmentModifierProtection(null);
|
||||||
private static final EnchantmentManager.EnchantmentModifierDamage b = new EnchantmentManager.EnchantmentModifierDamage(null);
|
private static final EnchantmentManager.EnchantmentModifierDamage b = new EnchantmentManager.EnchantmentModifierDamage(null);
|
||||||
public static final EnchantmentManager.EnchantmentModifierThorns c = new EnchantmentManager.EnchantmentModifierThorns(null); // Akarin - private -> public
|
private static final EnchantmentManager.EnchantmentModifierThorns c = new EnchantmentManager.EnchantmentModifierThorns(null);
|
||||||
public static final EnchantmentManager.EnchantmentModifierArthropods d = new EnchantmentManager.EnchantmentModifierArthropods(null); // Akarin - private -> public
|
private static final EnchantmentManager.EnchantmentModifierArthropods d = new EnchantmentManager.EnchantmentModifierArthropods(null);
|
||||||
|
|
||||||
public static int getEnchantmentLevel(Enchantment enchantment, ItemStack itemstack) {
|
public static int getEnchantmentLevel(Enchantment enchantment, ItemStack itemstack) {
|
||||||
if (itemstack.isEmpty()) {
|
if (itemstack.isEmpty()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user