diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 19cfad96..81aa1c04 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/src/main/java/de/flo56958/minetinker/modifiers/ModManager.java b/src/main/java/de/flo56958/minetinker/modifiers/ModManager.java index b5fa73c5..e93dc31e 100644 --- a/src/main/java/de/flo56958/minetinker/modifiers/ModManager.java +++ b/src/main/java/de/flo56958/minetinker/modifiers/ModManager.java @@ -973,37 +973,37 @@ public void addArmorAttributes(@NotNull final ItemStack is) { knockbackResAM = new AttributeModifier(nkKnockbackRes, knockback_res, AttributeModifier.Operation.ADD_NUMBER, EquipmentSlotGroup.LEGS); } else if (!ToolType.ELYTRA.contains(is.getType())) return; - Collection list = meta.getAttributeModifiers(Attribute.GENERIC_ARMOR); + Collection list = meta.getAttributeModifiers(Attribute.ARMOR); if (list != null) { list = new ArrayList<>(list); // Collection is immutable list.removeIf(am -> !nkArmor.getNamespace().equals(am.getKey().getNamespace())); list.removeIf(am -> !nkArmor.getKey().contains(am.getKey().getKey())); - list.forEach(am -> meta.removeAttributeModifier(Attribute.GENERIC_ARMOR, am)); + list.forEach(am -> meta.removeAttributeModifier(Attribute.ARMOR, am)); } if (armor > 0.0d && armorAM != null) { - meta.addAttributeModifier(Attribute.GENERIC_ARMOR, armorAM); + meta.addAttributeModifier(Attribute.ARMOR, armorAM); } - list = meta.getAttributeModifiers(Attribute.GENERIC_ARMOR_TOUGHNESS); + list = meta.getAttributeModifiers(Attribute.ARMOR_TOUGHNESS); if (list != null) { list = new ArrayList<>(list); // Collection is immutable list.removeIf(am -> !nkArmorToughness.getNamespace().equals(am.getKey().getNamespace())); list.removeIf(am -> !nkArmorToughness.getKey().contains(am.getKey().getKey())); - list.forEach(am -> meta.removeAttributeModifier(Attribute.GENERIC_ARMOR_TOUGHNESS, am)); + list.forEach(am -> meta.removeAttributeModifier(Attribute.ARMOR_TOUGHNESS, am)); } if (toughness > 0.0d && toughnessAM != null) { - meta.addAttributeModifier(Attribute.GENERIC_ARMOR_TOUGHNESS, toughnessAM); + meta.addAttributeModifier(Attribute.ARMOR_TOUGHNESS, toughnessAM); } - list = meta.getAttributeModifiers(Attribute.GENERIC_KNOCKBACK_RESISTANCE); + list = meta.getAttributeModifiers(Attribute.KNOCKBACK_RESISTANCE); if (list != null) { list = new ArrayList<>(list); // Collection is immutable list.removeIf(am -> !nkKnockbackRes.getNamespace().equals(am.getKey().getNamespace())); list.removeIf(am -> !nkKnockbackRes.getKey().contains(am.getKey().getKey())); - list.forEach(am -> meta.removeAttributeModifier(Attribute.GENERIC_KNOCKBACK_RESISTANCE, am)); + list.forEach(am -> meta.removeAttributeModifier(Attribute.KNOCKBACK_RESISTANCE, am)); } if (knockback_res > 0.0d && knockbackResAM != null) { - meta.addAttributeModifier(Attribute.GENERIC_KNOCKBACK_RESISTANCE, knockbackResAM); + meta.addAttributeModifier(Attribute.KNOCKBACK_RESISTANCE, knockbackResAM); } if (config.getBoolean("HideAttributes")) { diff --git a/src/main/java/de/flo56958/minetinker/modifiers/types/Berserk.java b/src/main/java/de/flo56958/minetinker/modifiers/types/Berserk.java index e0590af6..553f7829 100644 --- a/src/main/java/de/flo56958/minetinker/modifiers/types/Berserk.java +++ b/src/main/java/de/flo56958/minetinker/modifiers/types/Berserk.java @@ -110,7 +110,7 @@ public void onHit(@NotNull EntityDamageEvent event) { if (modifierLevel <= 0) return; final double lifeAfterDamage = player.getHealth() - event.getFinalDamage(); - AttributeInstance healthAttr = player.getAttribute(Attribute.GENERIC_MAX_HEALTH); + AttributeInstance healthAttr = player.getAttribute(Attribute.MAX_HEALTH); double maxHealth = 20; if (healthAttr != null) maxHealth = healthAttr.getValue(); diff --git a/src/main/java/de/flo56958/minetinker/modifiers/types/Hardened.java b/src/main/java/de/flo56958/minetinker/modifiers/types/Hardened.java index dbc5a6ad..d7460faf 100644 --- a/src/main/java/de/flo56958/minetinker/modifiers/types/Hardened.java +++ b/src/main/java/de/flo56958/minetinker/modifiers/types/Hardened.java @@ -52,7 +52,7 @@ public List getAllowedTools() { @Override public @NotNull List getAppliedAttributes() { - return Arrays.asList(Attribute.GENERIC_ARMOR, Attribute.GENERIC_ARMOR_TOUGHNESS); + return Arrays.asList(Attribute.ARMOR, Attribute.ARMOR_TOUGHNESS); } @Override @@ -81,7 +81,7 @@ public boolean applyMod(Player player, ItemStack tool, boolean isCommand) { default -> null; }; assert armorAM != null; - meta.addAttributeModifier(Attribute.GENERIC_ARMOR, armorAM); + meta.addAttributeModifier(Attribute.ARMOR, armorAM); } } @@ -102,7 +102,7 @@ public boolean applyMod(Player player, ItemStack tool, boolean isCommand) { default -> null; }; assert toughnessAM != null; - meta.addAttributeModifier(Attribute.GENERIC_ARMOR_TOUGHNESS, toughnessAM); + meta.addAttributeModifier(Attribute.ARMOR_TOUGHNESS, toughnessAM); } } tool.setItemMeta(meta); @@ -120,21 +120,21 @@ public void removeMod(ItemStack tool) { final ToolType toolType = ToolType.get(tool.getType()); final NamespacedKey nkArmor = new NamespacedKey(MineTinker.getPlugin(), this.sArmor + toolType.name()); - Collection list = meta.getAttributeModifiers(Attribute.GENERIC_ARMOR); + Collection list = meta.getAttributeModifiers(Attribute.ARMOR); if (list != null) { list = new ArrayList<>(list); // Collection is immutable list.removeIf(am -> !nkArmor.getNamespace().equals(am.getKey().getNamespace())); list.removeIf(am -> !nkArmor.getKey().contains(am.getKey().getKey())); - list.forEach(am -> meta.removeAttributeModifier(Attribute.GENERIC_ARMOR, am)); + list.forEach(am -> meta.removeAttributeModifier(Attribute.ARMOR, am)); } final NamespacedKey nkArmorToughness = new NamespacedKey(MineTinker.getPlugin(), this.sArmorToughness + toolType.name()); - list = meta.getAttributeModifiers(Attribute.GENERIC_ARMOR_TOUGHNESS); + list = meta.getAttributeModifiers(Attribute.ARMOR_TOUGHNESS); if (list != null) { list = new ArrayList<>(list); // Collection is immutable list.removeIf(am -> !nkArmorToughness.getNamespace().equals(am.getKey().getNamespace())); list.removeIf(am -> !nkArmorToughness.getKey().contains(am.getKey().getKey())); - list.forEach(am -> meta.removeAttributeModifier(Attribute.GENERIC_ARMOR_TOUGHNESS, am)); + list.forEach(am -> meta.removeAttributeModifier(Attribute.ARMOR_TOUGHNESS, am)); } tool.setItemMeta(meta); } diff --git a/src/main/java/de/flo56958/minetinker/modifiers/types/Lifesteal.java b/src/main/java/de/flo56958/minetinker/modifiers/types/Lifesteal.java index 347ab7e3..6fe57776 100644 --- a/src/main/java/de/flo56958/minetinker/modifiers/types/Lifesteal.java +++ b/src/main/java/de/flo56958/minetinker/modifiers/types/Lifesteal.java @@ -113,7 +113,7 @@ public void effect(MTEntityDamageByEntityEvent event) { final double recovery = damage * ((percentPerLevel * level) / 100.0); final double health = player.getHealth() + recovery; - AttributeInstance attribute = player.getAttribute(Attribute.GENERIC_MAX_HEALTH); + AttributeInstance attribute = player.getAttribute(Attribute.MAX_HEALTH); if (attribute != null) // for IllegalArgumentException if Health is bigger than MaxHealth player.setHealth(Math.min(health, attribute.getValue())); diff --git a/src/main/java/de/flo56958/minetinker/modifiers/types/Poisonous.java b/src/main/java/de/flo56958/minetinker/modifiers/types/Poisonous.java index 6501058e..44a7c530 100644 --- a/src/main/java/de/flo56958/minetinker/modifiers/types/Poisonous.java +++ b/src/main/java/de/flo56958/minetinker/modifiers/types/Poisonous.java @@ -141,7 +141,7 @@ public void onDamage(final EntityDamageEvent event) { if (damage > 0) { event.setDamage(0); double health = player.getHealth(); - player.setHealth(Math.min(health + damage, player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue())); + player.setHealth(Math.min(health + damage, player.getAttribute(Attribute.MAX_HEALTH).getValue())); ChatWriter.logModifier(player, event, this, armor, String.format("Health(%.2f -> %.2f)", health, player.getHealth())); } } diff --git a/src/main/java/de/flo56958/minetinker/modifiers/types/Speedy.java b/src/main/java/de/flo56958/minetinker/modifiers/types/Speedy.java index d3845c69..f624e297 100644 --- a/src/main/java/de/flo56958/minetinker/modifiers/types/Speedy.java +++ b/src/main/java/de/flo56958/minetinker/modifiers/types/Speedy.java @@ -50,7 +50,7 @@ public List getAllowedTools() { @Override public @NotNull List getAppliedAttributes() { - return Collections.singletonList(Attribute.GENERIC_MOVEMENT_SPEED); + return Collections.singletonList(Attribute.MOVEMENT_SPEED); } private final String sMovementSpeed = this.getKey() + ".movement_speed_"; @@ -63,12 +63,12 @@ public void removeMod(ItemStack tool) { final ToolType toolType = ToolType.get(tool.getType()); final NamespacedKey nkMovementSpeed = new NamespacedKey(MineTinker.getPlugin(), sMovementSpeed + toolType.name()); - Collection list = meta.getAttributeModifiers(Attribute.GENERIC_MOVEMENT_SPEED); + Collection list = meta.getAttributeModifiers(Attribute.MOVEMENT_SPEED); if (list != null) { list = new ArrayList<>(list); // Collection is immutable list.removeIf(am -> !nkMovementSpeed.getNamespace().equals(am.getKey().getNamespace())); list.removeIf(am -> !nkMovementSpeed.getKey().contains(am.getKey().getKey())); - list.forEach(am -> meta.removeAttributeModifier(Attribute.GENERIC_MOVEMENT_SPEED, am)); + list.forEach(am -> meta.removeAttributeModifier(Attribute.MOVEMENT_SPEED, am)); } tool.setItemMeta(meta); @@ -86,11 +86,11 @@ public boolean applyMod(Player player, ItemStack tool, boolean isCommand) { final NamespacedKey nkMovementSpeed = new NamespacedKey(MineTinker.getPlugin(), sMovementSpeed + toolType.name()); if (ToolType.LEGGINGS.contains(tool.getType())) - meta.addAttributeModifier(Attribute.GENERIC_MOVEMENT_SPEED, + meta.addAttributeModifier(Attribute.MOVEMENT_SPEED, new AttributeModifier(nkMovementSpeed, level * this.speedPerLevel, AttributeModifier.Operation.ADD_NUMBER, EquipmentSlotGroup.LEGS)); else - meta.addAttributeModifier(Attribute.GENERIC_MOVEMENT_SPEED, + meta.addAttributeModifier(Attribute.MOVEMENT_SPEED, new AttributeModifier(nkMovementSpeed, level * this.speedPerLevel, AttributeModifier.Operation.ADD_NUMBER, EquipmentSlotGroup.FEET)); diff --git a/src/main/java/de/flo56958/minetinker/modifiers/types/Tanky.java b/src/main/java/de/flo56958/minetinker/modifiers/types/Tanky.java index 05480cc7..244790ef 100644 --- a/src/main/java/de/flo56958/minetinker/modifiers/types/Tanky.java +++ b/src/main/java/de/flo56958/minetinker/modifiers/types/Tanky.java @@ -61,7 +61,7 @@ public List getAllowedTools() { @Override public @NotNull List getAppliedAttributes() { - return Collections.singletonList(Attribute.GENERIC_MAX_HEALTH); + return Collections.singletonList(Attribute.MAX_HEALTH); } private final String sHealth = this.getKey() + ".max_health_"; @@ -74,12 +74,12 @@ public void removeMod(ItemStack tool) { final ToolType toolType = ToolType.get(tool.getType()); final NamespacedKey nkHealth = new NamespacedKey(MineTinker.getPlugin(), sHealth + toolType.name()); - Collection list = meta.getAttributeModifiers(Attribute.GENERIC_MAX_HEALTH); + Collection list = meta.getAttributeModifiers(Attribute.MAX_HEALTH); if (list != null) { list = new ArrayList<>(list); // Collection is immutable list.removeIf(am -> !nkHealth.getNamespace().equals(am.getKey().getNamespace())); list.removeIf(am -> !nkHealth.getKey().contains(am.getKey().getKey())); - list.forEach(am -> meta.removeAttributeModifier(Attribute.GENERIC_MAX_HEALTH, am)); + list.forEach(am -> meta.removeAttributeModifier(Attribute.MAX_HEALTH, am)); } tool.setItemMeta(meta); @@ -98,10 +98,10 @@ public boolean applyMod(Player player, ItemStack tool, boolean isCommand) { final NamespacedKey nkHealth = new NamespacedKey(MineTinker.getPlugin(), sHealth + toolType.name()); if (ToolType.LEGGINGS.contains(tool.getType())) - meta.addAttributeModifier(Attribute.GENERIC_MAX_HEALTH, new AttributeModifier(nkHealth, level * this.healthPerLevel, + meta.addAttributeModifier(Attribute.MAX_HEALTH, new AttributeModifier(nkHealth, level * this.healthPerLevel, AttributeModifier.Operation.ADD_NUMBER, EquipmentSlotGroup.LEGS)); else //Chestplate and Elytra - meta.addAttributeModifier(Attribute.GENERIC_MAX_HEALTH, new AttributeModifier(nkHealth, level * this.healthPerLevel, + meta.addAttributeModifier(Attribute.MAX_HEALTH, new AttributeModifier(nkHealth, level * this.healthPerLevel, AttributeModifier.Operation.ADD_NUMBER, EquipmentSlotGroup.CHEST)); tool.setItemMeta(meta); diff --git a/src/main/java/de/flo56958/minetinker/modifiers/types/Vigilant.java b/src/main/java/de/flo56958/minetinker/modifiers/types/Vigilant.java index 579e3e87..c30ac84a 100644 --- a/src/main/java/de/flo56958/minetinker/modifiers/types/Vigilant.java +++ b/src/main/java/de/flo56958/minetinker/modifiers/types/Vigilant.java @@ -96,8 +96,8 @@ private void effect(@NotNull final Player player, final double damage) { // Make sure the player can receive the absorption final ItemMeta meta = chestplate.getItemMeta(); if (meta == null) return; - meta.removeAttributeModifier(Attribute.GENERIC_MAX_ABSORPTION); // Overwrite the old values - meta.addAttributeModifier(Attribute.GENERIC_MAX_ABSORPTION, new AttributeModifier( + meta.removeAttributeModifier(Attribute.MAX_ABSORPTION); // Overwrite the old values + meta.addAttributeModifier(Attribute.MAX_ABSORPTION, new AttributeModifier( new NamespacedKey(MineTinker.getPlugin(), "generic.max_absorption"), absorption, AttributeModifier.Operation.ADD_NUMBER, EquipmentSlotGroup.CHEST)); chestplate.setItemMeta(meta); diff --git a/src/main/java/de/flo56958/minetinker/modifiers/types/Withered.java b/src/main/java/de/flo56958/minetinker/modifiers/types/Withered.java index f97bad2c..0933007b 100644 --- a/src/main/java/de/flo56958/minetinker/modifiers/types/Withered.java +++ b/src/main/java/de/flo56958/minetinker/modifiers/types/Withered.java @@ -144,7 +144,7 @@ public void onDamage(EntityDamageEvent event) { if (damage > 0) { event.setDamage(0); double health = player.getHealth(); - player.setHealth(Math.min(health + damage, player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue())); + player.setHealth(Math.min(health + damage, player.getAttribute(Attribute.MAX_HEALTH).getValue())); ChatWriter.logModifier(player, event, this, armor, String.format("Health(%.2f -> %.2f)", health, player.getHealth())); } }