add vanity enchantment

This commit is contained in:
Sen 2025-07-31 01:45:29 +02:00
parent fb6b612934
commit 2d34d139c5
Signed by: sen
GPG key ID: 3AC50A6F47D1B722
3 changed files with 20 additions and 2 deletions

View file

@ -7,6 +7,8 @@ import client.renderer.GlState;
import client.renderer.entity.RendererLivingEntity; import client.renderer.entity.RendererLivingEntity;
import client.renderer.model.ModelArmor; import client.renderer.model.ModelArmor;
import client.renderer.model.ModelBiped; import client.renderer.model.ModelBiped;
import common.enchantment.Enchantment;
import common.enchantment.EnchantmentHelper;
import common.entity.types.EntityLiving; import common.entity.types.EntityLiving;
import common.item.ItemStack; import common.item.ItemStack;
import common.item.material.ItemArmor; import common.item.material.ItemArmor;
@ -50,9 +52,8 @@ public class LayerArmor implements LayerRenderer<EntityLiving>
{ {
ItemStack itemstack = this.getCurrentArmor(entitylivingbaseIn, armorSlot); ItemStack itemstack = this.getCurrentArmor(entitylivingbaseIn, armorSlot);
if (itemstack != null && itemstack.getItem() instanceof ItemArmor) if (itemstack != null && itemstack.getItem() instanceof ItemArmor itemarmor && (this.renderer == null || EnchantmentHelper.getEnchantmentLevel(Enchantment.VANITY, itemstack) <= 0))
{ {
ItemArmor itemarmor = (ItemArmor)itemstack.getItem();
ModelArmor t = this.getArmorModel(armorSlot); ModelArmor t = this.getArmorModel(armorSlot);
t.setModelAttributes(this.renderer != null ? this.renderer.getMainModel() : null); t.setModelAttributes(this.renderer != null ? this.renderer.getMainModel() : null);
t.setLivingAnimations(entitylivingbaseIn, limbSwing, limbSwingAmount, partial); t.setLivingAnimations(entitylivingbaseIn, limbSwing, limbSwingAmount, partial);

View file

@ -507,6 +507,22 @@ public enum Enchantment implements Displayable, Identifyable
user.heal((int)((entity.arePotionsInverted() ? 0.2f : 1.0f) * (float)level)); user.heal((int)((entity.arePotionsInverted() ? 0.2f : 1.0f) * (float)level));
} }
} }
},
VANITY("vanity", 2, EnchantmentType.ARMOR, "Transparenz") {
public int getMinEnchantability(int enchantmentLevel)
{
return 3;
}
public int getMaxEnchantability(int enchantmentLevel)
{
return this.getMinEnchantability(enchantmentLevel) + 20;
}
public int getMaxLevel()
{
return 1;
}
}; };
private static final String[] LEVELS = new String[] {"I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX", "X"}; private static final String[] LEVELS = new String[] {"I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX", "X"};

View file

@ -878,6 +878,7 @@ public abstract class Items {
public static final ItemEnchantedBook enchanted_book_thorns_3 = get("enchanted_book_thorns_3"); public static final ItemEnchantedBook enchanted_book_thorns_3 = get("enchanted_book_thorns_3");
public static final ItemEnchantedBook enchanted_book_unbreaking = get("enchanted_book_unbreaking"); public static final ItemEnchantedBook enchanted_book_unbreaking = get("enchanted_book_unbreaking");
public static final ItemEnchantedBook enchanted_book_unbreaking_3 = get("enchanted_book_unbreaking_3"); public static final ItemEnchantedBook enchanted_book_unbreaking_3 = get("enchanted_book_unbreaking_3");
public static final ItemEnchantedBook enchanted_book_vanity = get("enchanted_book_vanity");
public static final ItemRocketLauncher rocket_launcher = get("rocket_launcher"); public static final ItemRocketLauncher rocket_launcher = get("rocket_launcher");
public static final ItemAmmo rocket = get("rocket"); public static final ItemAmmo rocket = get("rocket");
public static final ItemPotion water_bottle = get("water_bottle"); public static final ItemPotion water_bottle = get("water_bottle");