Jump to content

method does not override or implement a method from a supertype @Override


Recommended Posts

Hi, I have a problem with the code, it crashes with error method does not override or implement a method from a supertype
I am using 3D model in my Minecraft mod and want to make a feature that will show 16x16 2D texture in inventory and generally in all GUI, and when item in hand it will show 3D model. Using forge 1.18.2 40.1.0 to create the mod.  Here is my code:

package net.mcreator.irondrill.item;

import net.minecraft.world.level.Level;
import net.minecraft.world.item.crafting.Ingredient;
import net.minecraft.world.item.Tier;
import net.minecraft.world.item.PickaxeItem;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Item;
import net.minecraft.world.entity.Entity;

import net.mcreator.irondrill.procedures.MagnitProcedure;
import net.mcreator.irondrill.init.DrillsModTabs;

public class GravityDrillItem extends PickaxeItem {
	public GravityDrillItem() {
		super(new Tier() {
			public int getUses() {
				return 2500;
			}

			public float getSpeed() {
				return 70f;
			}

			public float getAttackDamageBonus() {
				return 6f;
			}

			public int getLevel() {
				return 4;
			}

			public int getEnchantmentValue() {
				return 2;
			}

			public Ingredient getRepairIngredient() {
				return Ingredient.EMPTY;
			}
		}, 1, -3.5f, new Item.Properties().tab(DrillsModTabs.TAB_DRILLMOD));
	}

	@Override
	public void inventoryTick(ItemStack itemstack, Level world, Entity entity, int slot, boolean selected) {
		super.inventoryTick(itemstack, world, entity, slot, selected);
		if (selected)
			MagnitProcedure.execute(world, entity.getX(), entity.getY(), entity.getZ(), entity);
	}

	@Override // a line that makes the code not work.
	public boolean shouldRenderGroup(ItemStack stack, String group) {
		return group.equals("normal") || group.equals("inventory");
	}

	@Override
	public int getUseDuration(ItemStack stack) {
		return 0;
	}
}

How can this be fixed?

(Translated)

Link to comment
Share on other sites

  • 2 weeks later...

If mc doesn't like your code in an Overridden function, it decides not to run that code and shows you the issue with the "does not override or implement a method from its supertype" error. You will see that if you remove the Override annotation, then there will be no action icon in the margin cos mc is unwilling to run it. To fix it, you must recreate mc acceptable code.

Link to comment
Share on other sites

16 minutes ago, DinoPawz said:

If mc doesn't like your code in an Overridden function, it decides not to run that code and shows you the issue with the "does not override or implement a method from its supertype" error. You will see that if you remove the Override annotation, then there will be no action icon in the margin cos mc is unwilling to run it. To fix it, you must recreate mc acceptable code.

That's because overridden methods need to have the same signature as their supertype, you can't just go specifying your own new parameters and returns otherwise it becomes a different method.

I'm the CEO of breaking things 

Link to comment
Share on other sites

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.



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Also wondering how to create these manually.  First time creating a forge server.
    • Exception in thread "main" java.lang.IllegalStateException: Could not find forge-1.19-41.1.0 in classpath at MC-BOOTSTRAP/fmlloader@1.19.2-43.3.5/net.minecraftforge.fml.loading.targets.CommonDevLaunchHandler.lambda$findJarOnClasspath$3(CommonDevLaunchHandler.java:90) at java.base/java.util.Optional.orElseThrow(Optional.java:403) at MC-BOOTSTRAP/fmlloader@1.19.2-43.3.5/net.minecraftforge.fml.loading.targets.CommonDevLaunchHandler.findJarOnClasspath(CommonDevLaunchHandler.java:90) at MC-BOOTSTRAP/fmlloader@1.19.2-43.3.5/net.minecraftforge.fml.loading.targets.ForgeUserdevLaunchHandler.processStreams(ForgeUserdevLaunchHandler.java:17) at MC-BOOTSTRAP/fmlloader@1.19.2-43.3.5/net.minecraftforge.fml.loading.targets.CommonUserdevLaunchHandler.getMinecraftPaths(CommonUserdevLaunchHandler.java:32) at MC-BOOTSTRAP/fmlloader@1.19.2-43.3.5/net.minecraftforge.fml.loading.moddiscovery.MinecraftLocator.scanMods(MinecraftLocator.java:36) at MC-BOOTSTRAP/fmlloader@1.19.2-43.3.5/net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer.discoverMods(ModDiscoverer.java:74) at MC-BOOTSTRAP/fmlloader@1.19.2-43.3.5/net.minecraftforge.fml.loading.FMLLoader.beginModScan(FMLLoader.java:166) at MC-BOOTSTRAP/fmlloader@1.19.2-43.3.5/net.minecraftforge.fml.loading.FMLServiceProvider.beginScanning(FMLServiceProvider.java:86) at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.9/cpw.mods.modlauncher.TransformationServiceDecorator.runScan(TransformationServiceDecorator.java:112) at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.9/cpw.mods.modlauncher.TransformationServicesHandler.lambda$runScanningTransformationServices$8(TransformationServicesHandler.java:100) at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197) at java.base/java.util.HashMap$ValueSpliterator.forEachRemaining(HashMap.java:1779) at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:575) at java.base/java.util.stream.AbstractPipeline.evaluateToArrayNode(AbstractPipeline.java:260) at java.base/java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:616) at java.base/java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:622) at java.base/java.util.stream.ReferencePipeline.toList(ReferencePipeline.java:627) at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.9/cpw.mods.modlauncher.TransformationServicesHandler.runScanningTransformationServices(TransformationServicesHandler.java:102) at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.9/cpw.mods.modlauncher.TransformationServicesHandler.initializeTransformationServices(TransformationServicesHandler.java:55) at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.9/cpw.mods.modlauncher.Launcher.run(Launcher.java:88) at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.9/cpw.mods.modlauncher.Launcher.main(Launcher.java:78) at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.9/cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.9/cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) at cpw.mods.bootstraplauncher@1.1.2/cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:141) I tried to make a minecraft mod but this error appears every time I click on the RunClient button and it won't start. Does anyone know how to get rid of this? (btw. I'm using version 1.19.2-43.3.5) https://pastebin.com/mQ3q4SwW
    • I've been following the discussion on automatically downloading mods from server to client, and I thought I'd share a helpful resource I stumbled upon. If you're looking for high-quality images for your mods or any other project, Depositphotos offers a fantastic collection for free download: free download images. In the spirit of collaboration, I believe that access to free, high-resolution visuals can greatly enhance the overall modding experience. Feel free to explore the link, and let me know what you think. Looking forward to hearing your thoughts and ideas on how we can collectively improve mod development efficiency.
    • Indian & Pakistani Girls (+971525382202{{ Dubai House Wife Indian Call 'Girl Deira Indian & Pakistani Girls (+971525382202{{ Dubai House Wife Indian Call 'Girl Deira Indian & Pakistani Girls (+971525382202{{ Dubai House Wife Indian Call 'Girl Deira Indian & Pakistani Girls (+971525382202{{ Dubai House Wife Indian Call 'Girl Deira Indian & Pakistani Girls (+971525382202{{ Dubai House Wife Indian Call 'Girl Deira Indian & Pakistani Girls (+971525382202{{ Dubai House Wife Indian Call 'Girl Deira
    • full-service 0506530048 pakistani call 'girls in deira by dubai full-service 0506530048 pakistani call 'girls in deira by dubai full-service 0506530048 pakistani call 'girls in deira by dubai full-service 0506530048 pakistani call 'girls in deira by dubai full-service 0506530048 pakistani call 'girls in deira by dubai full-service 0506530048 pakistani call 'girls in deira by dubai
  • Topics

×
×
  • Create New...

Important Information

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