Jump to content

Search the Community

Showing results for tags 'enchantments'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • Minecraft Forge
    • Releases
    • Support & Bug Reports
    • Suggestions
    • General Discussion
  • Mod Developer Central
    • Modder Support
    • User Submitted Tutorials
  • Non-Forge
    • Site News (non-forge)
    • Minecraft General
    • Off-topic
  • Forge Mods
    • Mods

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start









Yahoo IM

MSN Messenger

Personal Text

Found 6 results

  1. Hey, I'm trying to write a mod that allows you to have channeling and riptide at the same time on a trident. But I came to the conclusion that this is not possible without mixins because the method that checks enchantments is in the EnchantmentHelper class and not in the Trident Item or ThrownTrident class. Since I can't overwrite the EnchantmentHelper class and don't actually want to use mixins because I'm not familiar with it, I wanted to ask you how you would go about it and whether there aren't other options. I would be really happy about your help
  2. Hello, I'm trying to modify the effects of native enchantments for bows and arrows in Minecraft. After using a decompilation tool, I found that the specific implementations of native bow and arrow enchantments (including `ArrowDamageEnchantment`, `ArrowKnockbackEnchantment`, `ArrowFireEnchantment`, `ArrowInfiniteEnchantment`, `ArrowPiercingEnchantment`) do not contain any information about the enchantment effects (such as the `getDamageProtection` function for `ProtectionEnchantment`, `getDamageBonus` function for `DamageEnchantment`, etc.). Upon searching for the base class of arrows, `AbstractArrow`, I found a function named setEnchantmentEffectsFromEntity`, which seems to be used to retrieve the enchantment levels of the tool held by a `LivingEntity` and calculate the specific values of the enchantment effects. However, after testing with the following code, I found that this function is not being called: @Mixin(AbstractArrow.class) public class ModifyArrowEnchantmentEffects { private static final Logger LOGGER = LogUtils.getLogger(); @Inject( method = "setEnchantmentEffectsFromEntity", at = @At("HEAD") ) private void logArrowEnchantmentEffectsFromEntity(CallbackInfo ci) { LOGGER.info("Arrow enchantment effects from entity"); } } Upon further investigation, I found that within the onHitEntity method, there are several lines of code: if (!this.level().isClientSide && entity1 instanceof LivingEntity) { EnchantmentHelper.doPostHurtEffects(livingentity, entity1); EnchantmentHelper.doPostDamageEffects((LivingEntity)entity1, livingentity); } These lines of code actually call the doPostHurt and doPostAttack methods of each enchantment in the enchantment list. However, this leads back to the issue because native bow and arrow enchantments do not implement these functions. Although their base class defines the functions, they are empty. At this point, I'm completely stumped and seeking assistance. Thank you.
  3. I cannot find the answer anywhere public static void onPlayerConsumeXp(PlayerXpEvent.PickupXp event){ if(event.getEntity().getMainHandItem().getAllEnchantments().get(*value i need*) != null){ int shorthand = event.getEntity().getMainHandItem().getAllEnchantments().get(*value i need*); I am trying to get my custom enchant inside that *value i need*, I have tried using strings and Enchantments. does not show my enchantment. This is my enchantment class package net.test.tutorialmod.enchants; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.item.enchantment.Enchantment; import net.minecraft.world.item.enchantment.EnchantmentCategory; public class clever extends Enchantment { public clever(Rarity pRarity, EnchantmentCategory pCategory, EquipmentSlot... pApplicableSlots) { super(pRarity, pCategory, pApplicableSlots); } @Override public int getMaxLevel() { return 10; } @Override public int getMinLevel() { return 1; } } What am i doing wrong?
  4. I'm new to modding, and trying to create an enchantment that causes killed mobs to drop extra experience. I've learned that you can spawn entities, such as extra experience orbs, using the doPostAttack method. How could I make it so that the extra experience is only spawned once the target is killed? Here's the enchantment I'm working on, which currently spawns 1 experience orb when the player hits an entity: public class ProficiencyEnchantment extends Enchantment { public ProficiencyEnchantment(Rarity pRarity, EnchantmentCategory pCategory, EquipmentSlot... pApplicableSlots) { super(pRarity, pCategory, pApplicableSlots); } public void doPostAttack(LivingEntity pAttacker, Entity pTarget, int pLevel) { if(!pAttacker.level().isClientSide()) { ServerLevel world = ((ServerLevel) pAttacker.level()); BlockPos position = pTarget.blockPosition(); if(pLevel == 1) { EntityType.EXPERIENCE_ORB.spawn(world, (ItemStack) null, null, position, MobSpawnType.TRIGGERED, true, true); } } } @Override public int getMaxLevel() { return 1; } }
  5. I'm trying to add a custom enchantment that is only compatible with a new type of tiered weapon I made. I am using 1.19.3, forge version 44.0.1. I tried using EnchantmentCategory#create(), but it doesn't work. Here is the enchantment class: package everyblu.extendedarmory.common.enchantments; import everyblu.extendedarmory.common.item.LongswordItem; import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.core.particles.ParticleTypes; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.item.enchantment.Enchantment; import net.minecraft.world.item.enchantment.EnchantmentCategory; import org.jetbrains.annotations.NotNull; public class ThrustingEnchantment extends Enchantment { static EnchantmentCategory LONGSWORD_TYPE = EnchantmentCategory.create("thrusting", item -> item instanceof LongswordItem); public ThrustingEnchantment() { super(Rarity.RARE, LONGSWORD_TYPE, new EquipmentSlot[]{EquipmentSlot.MAINHAND, EquipmentSlot.OFFHAND}); } @Override public int getMaxLevel() { return 3; } @Override public void doPostAttack(@NotNull LivingEntity attacker, @NotNull Entity target, int tier) { if (attacker.getLevel().isClientSide()) { ClientLevel level = ((ClientLevel) attacker.getLevel()); if (tier >= 1) level.addParticle(ParticleTypes.SONIC_BOOM, target.position().x,target.position().y, target.position().z, 0, 0, 0); //This part is not finished. } } } Here is my enchants init class: package everyblu.extendedarmory.common.register; import everyblu.extendedarmory.ExtendedArmory; import everyblu.extendedarmory.common.enchantments.CutlassLuckEnchantment; import everyblu.extendedarmory.common.enchantments.ThrustingEnchantment; import net.minecraft.world.item.enchantment.Enchantment; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; import net.minecraftforge.registries.RegistryObject; public class ModEnchants { public static final DeferredRegister<Enchantment> ENCHANTMENTS = DeferredRegister.create(ForgeRegistries.ENCHANTMENTS, ExtendedArmory.MODID); public static RegistryObject<Enchantment> Thrusting = ENCHANTMENTS.register("thrusting", ThrustingEnchantment::new); public static RegistryObject<Enchantment> CutlassLuck = ENCHANTMENTS.register("cutlassluck", CutlassLuckEnchantment::new); public static void register(IEventBus eventBus) { ENCHANTMENTS.register(eventBus); } }
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.