Jump to content

Recommended Posts

Posted

If I want to change damage calculation of vanilla enchantments, is ASM the only way to achieve it or is it possible through reflection?

If it is only possible with ASM, then I want to create enchantment and disable vanilla ones.

In order to remove certain enchantments from game, should I just listen to events, such as world generation, fishing, enchanting and anvil, and cancel them or is there a better way to achieve it?

Posted

You can replace the Vanilla enchantments by registering your own enchantments with the same resource location as the originals. However, removing the enchantments completely is impossible to do without causing crashes.

Posted
40 minutes ago, CHEESEBOT314 said:

You can replace the Vanilla enchantments by registering your own enchantments with the same resource location as the originals.

Thanks. I will try that.

40 minutes ago, CHEESEBOT314 said:

However, removing the enchantments completely is impossible to do without causing crashes.

Enchanting methods are enchantment table, anvil combination and enchanted books which can be obtained through chest loot, fishing, trading, drops, enchanting and bartering.

Is removing enchantments still completely impossible even if I listen to these events and alter enchantments as I wish?

Posted
Just now, lisilew said:

Is removing enchantments still completely impossible even if I listen to these events and alter enchantments as I wish?

Even listening to all of those events won't stop other mods from having the vanilla enchants. IE if a tool or sword comes with an enchantment on it when crafted or dropped. What CHEESEBOT means is the enchantments will still exist within the game.

 

If you can get away with overriding the registry to change their function do that.

Honestly just saying you want to replace the vanilla enchantments isn't really enough information to help you. Which ones do you want to replace? And what do you hope to achieve by replacing them?

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted (edited)
26 minutes ago, Animefan8888 said:

Honestly just saying you want to replace the vanilla enchantments isn't really enough information to help you.

I apologize for not providing enough information.

My main purpose is to change how damages are calculated.

For example, I want bane of arthropods to deal extra damage to enderman alongside with spider.

I will be playing with my mod only or at least with mods that do not add anything to game so other mods are not a concern to me.

What I mean by removing enchantments is preventing players from obtaining those enchantments through normal ways.

Obtaining those enchantments via commands or mods providing players with items that have those enchantments are fine.

I am aware that those enchantments can still be obtained through commands but I am okay with that as normal players will not have access to that.

Edited by lisilew
Clarifying what removing enchantments menas
Posted
4 minutes ago, lisilew said:

My main purpose is to change how damages are calculated.

The damage based enchantments in Minecraft control their effect through their class directly. IE Enchantment::calcDamageByCreature. However it can't be used to make Bane of Arthropods deal damage to Endermen. In order to do that you will need to use LivingDamageEvent however that might not work how you expect it to because

Quote

At this point armor, potion and absorption modifiers have already been applied to damage

 

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted
38 minutes ago, Animefan8888 said:

In order to do that you will need to use LivingDamageEvent

This is actually what I have implemented.

I have created an enchantment Advanced Bane of Arthropods with calcDamageByCreature returning 0 and when LivingHurtEvent is fired, I modify damage according to enchantment level.

And this brought me another question: how are LivingDamageEvent and LivingHurtEvent different?

 

If using events is the only way to modify effects of enchantments, I will stick with it.

Now, if I want players to be able to use Advanced Bane of Arthropods only, do I register it as minecraft:bane_of_arthropods or is it possible to remove vanilla Bane of Arthropods from normal obtaining methods?

Posted
1 hour ago, lisilew said:

And this brought me another question: how are LivingDamageEvent and LivingHurtEvent different?

The difference is when the events are fired. You should actually use LivingHurtEvent I just didn't notice it because LivingDamageEvent shows up first.

 

LivingHurtEvent is fired before the damage reduction calculations are fired whereas LivingDamageEvent is fired afterwards.

1 hour ago, lisilew said:

Now, if I want players to be able to use Advanced Bane of Arthropods only, do I register it as minecraft:bane_of_arthropods or is it possible to remove vanilla Bane of Arthropods from normal obtaining methods?

You should just override the registry. Which is the first option. This way your enchantment will be treated exactly like the bane of arthropods enchantment.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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