Updated ItemizerX to the latest stable Paper version (1.21.8)

Given the complexity of the NMS update (including data components), I have decided to omit the support of older MC versions and maintain multiversion compatibility from 1.21.8 onwards from v2.4. I suspect this may not change much in the future, making it easier to maintain.

In the future, I may look into moving away from NMS provided Paper is now exposing them in Paper API via Data Components

This also closes #1
This commit is contained in:
Focusvity
2025-11-05 14:34:50 +11:00
parent 89b1143ab2
commit afd3223c24
22 changed files with 282 additions and 1635 deletions
+3 -3
View File
@@ -1,5 +1,5 @@
dependencies {
compileOnly("io.papermc.paper:paper-api:1.20.2-R0.1-SNAPSHOT")
paperweight.paperDevBundle("1.20.2-R0.1-SNAPSHOT")
compileOnly("net.coreprotect:coreprotect:22.2")
compileOnly("io.papermc.paper:paper-api:1.21..8-R0.1-SNAPSHOT")
paperweight.paperDevBundle("1.21.8-R0.1-SNAPSHOT")
compileOnly("net.coreprotect:coreprotect:22.4")
}
@@ -1,5 +1,7 @@
package dev.plex.itemizerx;
import net.minecraft.core.Holder;
import net.minecraft.world.entity.ai.attributes.Attribute;
import org.apache.commons.lang3.StringUtils;
import java.util.ArrayList;
@@ -7,27 +9,29 @@ import java.util.List;
public enum Attributes
{
MAX_HEALTH("generic.max_health", 0),
FOLLOW_RANGE("generic.follow_range", 1),
KNOCKBACK_RESISTANCE("generic.knockback_resistance", 1),
MOVEMENT_SPEED("generic.movement_speed", 1),
FLYING_SPEED("generic.flying_speed", 1),
DAMAGE("generic.attack_damage", 0),
ATTACK_KNOCKBACK("generic.attack_knockback", 0),
ATTACK_SPEED("generic.attack_speed", 1),
ARMOR("generic.armor", 0),
ARMOR_TOUGHNESS("generic.armor_toughness", 0),
LUCK("generic.luck", 0),
HORSE_JUMP("horse.jump_strength", 1),
ZOMBIE_REINFORCEMENTS("zombie.spawn_reinforcements", 1);
MAX_HEALTH("generic.max_health", 0, net.minecraft.world.entity.ai.attributes.Attributes.MAX_HEALTH),
FOLLOW_RANGE("generic.follow_range", 1, net.minecraft.world.entity.ai.attributes.Attributes.FOLLOW_RANGE),
KNOCKBACK_RESISTANCE("generic.knockback_resistance", 1, net.minecraft.world.entity.ai.attributes.Attributes.KNOCKBACK_RESISTANCE),
MOVEMENT_SPEED("generic.movement_speed", 1, net.minecraft.world.entity.ai.attributes.Attributes.MOVEMENT_SPEED),
FLYING_SPEED("generic.flying_speed", 1, net.minecraft.world.entity.ai.attributes.Attributes.FLYING_SPEED),
DAMAGE("generic.attack_damage", 0, net.minecraft.world.entity.ai.attributes.Attributes.ATTACK_DAMAGE),
ATTACK_KNOCKBACK("generic.attack_knockback", 0, net.minecraft.world.entity.ai.attributes.Attributes.ATTACK_KNOCKBACK),
ATTACK_SPEED("generic.attack_speed", 1, net.minecraft.world.entity.ai.attributes.Attributes.ATTACK_SPEED),
ARMOR("generic.armor", 0, net.minecraft.world.entity.ai.attributes.Attributes.ARMOR),
ARMOR_TOUGHNESS("generic.armor_toughness", 0, net.minecraft.world.entity.ai.attributes.Attributes.ARMOR_TOUGHNESS),
LUCK("generic.luck", 0, net.minecraft.world.entity.ai.attributes.Attributes.LUCK),
JUMP_STRENGTH("generic.jump_strength", 1, net.minecraft.world.entity.ai.attributes.Attributes.JUMP_STRENGTH),
ZOMBIE_REINFORCEMENTS("zombie.spawn_reinforcements", 1, net.minecraft.world.entity.ai.attributes.Attributes.SPAWN_REINFORCEMENTS_CHANCE);
public final String mcName;
public final int op;
public final Holder<Attribute> attributeHolder;
Attributes(String mcName, int op)
Attributes(String mcName, int op, Holder<Attribute> attributeHolder)
{
this.mcName = mcName;
this.op = op;
this.attributeHolder = attributeHolder;
}
public static Attributes get(String name)
@@ -1,25 +1,9 @@
package dev.plex.itemizerx;
import java.util.Collections;
import java.util.List;
import net.minecraft.nbt.ListTag;
import net.minecraft.world.entity.ai.attributes.AttributeModifier;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import org.bukkit.entity.Player;
public interface IAttributeManager
{
default ListTag getAttrList(final ItemStack item)
{
return null;
}
default List<AttributeModifier> getAttrList(final Item item)
{
return Collections.emptyList();
}
void addAttr(final Player player, final String[] args);
void removeAttr(final Player player, final String string);
@@ -0,0 +1,11 @@
package dev.plex.itemizerx;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
public interface IEnchantmentManager {
void addEnchantment(Player player, ItemStack item, String[] args);
void removeEnchantment(Player player, ItemStack item, String[] args);
}