Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

(1.16.1).setLightLevel and .setRequiresTool gives error Cannot resolve method 'setLightLevel' in 'Properties'


20ChenM
 Share

Recommended Posts

I just moved my 1.15.2 mod to 1.16.1 by replacing the build.gradle with a 1.16.1 build.gradle from the 1.16.1 mdk. I then recreated the workspace. For some reason though, the .set commands dont work and I get an error saying:Cannot resolve method 'setLightLevel' in 'Properties'

 

 

My Code:

package com.Michael.TutorialMod2.blocks;

import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraftforge.common.ToolType;

public class RubyBlock extends Block {


    public RubyBlock() {
        super(Block.Properties.create(Material.IRON)
        .hardnessAndResistance(5.0f,6.0f)
                        .sound(SoundType.METAL)
                .harvestLevel(3)
                .harvestTool(ToolType.PICKAXE)
                .setLightLevel(value ->1)
        );
    }
}
Link to comment
Share on other sites

Hi

Every time the Minecraft version updates, there are a lot of changes to functions; sometimes it's just the names, other times the signatures changes, and sometimes whole classes and groups of classes are refactored to work differently.

 

The best way to fix these problems during an update is 

1) Find a vanilla class that uses the method in (eg) 1.15.2

2) Find the same vanilla class in 1.16.3, browse through the code until you find the code that calls the same method and see what it has changed to.

 

90% of the time you'll find it within a minute.

 

-TGG

Link to comment
Share on other sites

I figured it out. My mappings were out of date. i was in 20200543.1.16 but I should have been in 20200723.1.16.1 

For anyone that has the same problem as me and comes across this forum, you can change the mapping version by going to the build.gradle file in your forge mdk and it will be around line 29.

Link to comment
Share on other sites

50 minutes ago, 20ChenM said:

what is an srg name?

Every class, method, field, parameter, and local variable has 4 names:

 

  1. Notch Names (these are what the game is originally programmed in). We do not have these for most things, Mojang is (supposedly?) publishing a deobf map, but I don't think it is in use by Forge yet.
  2. Obfuscated Names (these are what you would see if you opened Minecraft's source in a decompiler). a, aa, ab, abb, etc. It is unreadable.
  3. SRG Names (these are the first step in deobfuscation, machine translation from the obfuscated source to a consistent mapping). Not human readable, but the same method will always deobf to the same SRG name even as things change and get new Obfuscated names.
  4. MCP Names (these are the human readable ones). These take time and constant effort to map.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

50 minutes ago, Draco18s said:
  • Notch Names (these are what the game is originally programmed in). We do not have these for most things, Mojang is (supposedly?) publishing a deobf map, but I don't think it is in use by Forge yet.
  • Obfuscated Names (these are what you would see if you opened Minecraft's source in a decompiler). a, aa, ab, abb, etc. It is unreadable.

This is not quite correct. Notch names are the obfuscated names. The names that Mojang uses in their source code are sometimes called "official".

  • Thanks 1
Link to comment
Share on other sites

5 hours ago, 20ChenM said:

I figured it out. My mappings were out of date. i was in 20200543.1.16 but I should have been in 20200723.1.16.1 

For anyone that has the same problem as me and comes across this forum, you can change the mapping version by going to the build.gradle file in your forge mdk and it will be around line 29.

  

I never had issues with this before, but I guess the mappings that come with the MDK download are out of date? Didn't know we had to manually change them when downloading the MDK I guess that's new also on 1.16. Or is there a reason the "Recommended" version doesn't update this value?

 

My 1.16.3 download (forge-1.16.3-34.1.0-mdk) had on mappings

 

mappings channel: 'snapshot', version: '20200514-1.16'

 

Where you got the 20200723.1.16.1 from? So I can got get the corresponding for the 1.16.3- 34.1.0 version.

 

Thanks a lot.

 

 

Link to comment
Share on other sites

5 minutes ago, American2050 said:

  

I never had issues with this before, but I guess the mappings that come with the MDK download are out of date? Didn't know we had to manually change them when downloading the MDK I guess that's new also on 1.16. Or is there a reason the "Recommended" version doesn't update this value?

 

My 1.16.3 download (forge-1.16.3-34.1.0-mdk) had on mappings

 


mappings channel: 'snapshot', version: '20200514-1.16'

 

Where you got the 20200723.1.16.1 from? So I can got get the corresponding for the 1.16.3- 34.1.0 version.

 

Thanks a lot.

 

 

Take a look at this topic here: https://forums.minecraftforge.net/topic/91282-1161-setrequirestool/?tab=comments#comment-423212

  • Thanks 1

Check out the port of the BetterEnd fabric mod (WIP): https://www.curseforge.com/minecraft/mc-mods/betterend-forge-port

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.

Guest
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.

 Share



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • Okay, is it secure and can the code be copied to another file for usage or it has to be that exact file?
    • And if i run ./gradlew genEclipseRuns they are error:   * What went wrong: Could not resolve all files for configuration ':runtimeClasspathCopy'. > Could not find net.minecraftforge:forge:1.16.5-36.2.5_mapped_official_1.16.5.   Searched in the following locations:     - file:/Users/kikismine/.gradle/caches/forge_gradle/bundeled_repo/net/minecraftforge/forge/1.16.5-36.2.5_mapped_official_1.16.5/forge-1.16.5-36.2.5_mapped_official_1.16.5.pom     - file:/Users/kikismine/.gradle/caches/forge_gradle/bundeled_repo/net/minecraftforge/forge/1.16.5-36.2.5_mapped_official_1.16.5/forge-1.16.5-36.2.5_mapped_official_1.16.5.jar   Required by:       project :   * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.   * Get more help at https://help.gradle.org   Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.   You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.   See https://docs.gradle.org/7.1.1/userguide/command_line_interface.html#sec:command_line_warnings   BUILD FAILED in 51s kikismine@Krystof-MacBook-Air KikisMod %
    • The text doesn't show. What did I do wrong this time? public class GuiHandler { String text = "Hello world!"; @SubscribeEvent public void onRenderGui(RenderGameOverlayEvent.Post event) { OverlayRegistry.registerOverlayTop("hello", new IIngameOverlay() { @Override public void render(ForgeIngameGui gui, PoseStack mStack, float partialTicks, int width, int height) { drawString(mStack, Minecraft.getInstance().font, text, width / 2, height / 2, Integer.parseInt("33AA66", 16)); } }); } }
    • New Pastebin stay errors https://pastebin.com/7dUT78cj
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.