Jump to content

Recommended Posts

Posted (edited)

 

I was looking for how enchantment logic are made on minecraft code. I found classes like "LoyaltyEnchantment" , "EfficiencyEnchantment" , and more classes like "StuffEnchatment"

all of them inheriting from Enchantment class, so my question is where to add enchatment logic code from custom enchantment? Because no one of these classes has that code.

 

Thanks in advance, regards

Edited by littlemonge
Posted

I have a custom class but i add the enchantment code on my custom tool class because is an enchantment for tools , 

in my enchantment subclass there is only the overrides of EnchantMent base properties.

Posted

My enchantment its a tool repairing enchantment like mending but instead of working with experience it works with time ,every 30 sec (1200 minecraft tick),it  repairs a tool use enchanted with it.

 

So i done this on my tool class :

 

@Override
	public void inventoryTick(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected) {
		if (EnchantmentHelper.getEnchantments(stack).get(ModEnchantments.evil_mending) != null) {
			if (this.ticks == REPAIR_TIME_IN_SECONDS * TICKS_PER_SECOND) {
				this.ticks = 0;
				if (stack.isDamaged()) {
					stack.setDamage(stack.getDamage() - 1);
				}
			} else {
				ticks++;
			}
		}
		super.inventoryTick(stack, worldIn, entityIn, itemSlot, isSelected);

	}

 

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Hello, I want to change some things about a specific mod. I made some small mods for myself before, but I don't know how to use other mods as a dependencie and add the repositories. My build.gradle file looks something like this:   repositories { flatDir { dirs 'libs' } } dependencies { minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}" implementation fg.deobf("libs:create-1.20.1:0.5.1.f") implementation fg.deobf("libs:create-stuff-additions1.20.1:2.0.4a") } I have the folder libs in my root folder. If I start the gradlew.exe, I get the following output: > Configure project : Java: 17.0.15, JVM: 17.0.15+6 (Eclipse Adoptium), Arch: amd64 files(...) dependencies are not deobfuscated. Use a flatDir repository instead: https://docs.gradle.org/current/userguide/declaring_repositories.html#sub:flat_dir_resolver Cannot deobfuscate dependency of type DefaultSelfResolvingDependency_Decorated, using obfuscated version! files(...) dependencies are not deobfuscated. Use a flatDir repository instead: https://docs.gradle.org/current/userguide/declaring_repositories.html#sub:flat_dir_resolver Cannot deobfuscate dependency of type DefaultSelfResolvingDependency_Decorated, using obfuscated version! I don't know why this warning occurs or how to fix it. If I try to build the whole thing, I get the same message, but this time as an error and the build process crashes. I looked at the gradle dependencies website (https://docs.gradle.org/current/userguide/dependency_management_for_java_projects.html), but everything I tried did not work.   I use the Minecaft version 1.20.1 and the Forge version 47.2.17. Both mods don't have other dependencies and work perfectly fine if I start the game normaly.   Can someone explain to me why it does not work and/or where I can get help? Something like a documentation would be enough.
    • im just going to play without shaders(my friends will be dissapointed)
    • crashed the game // Embeddium instance tainted by mods: [oculus] // Please do not reach out for Embeddium support without removing these mods first. // ------- // Why did you do that? flywheel is needed for oculus but when i go into mc it then says sodium is 0.5.3(rubidum fork of sodium ported to forge)
    • oh wait i think i found the error  rubidium wasnt installed for oculus . IT WAS RUBIDIUM????????????????????
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

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