Posted June 13, 20232 yr 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)
June 15, 20232 yr The issue is that the method you have marked does not override or implement a method from its supertype (PickaxeItem).
June 24, 20232 yr Author On 6/15/2023 at 9:18 AM, fweo said: The issue is that the method you have marked does not override or implement a method from its supertype (PickaxeItem). Thanks
June 26, 20232 yr 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.
June 26, 20232 yr 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 ✨
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.