Jump to content

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


Recommended Posts

Posted

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)
        );
    }
}
Posted

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

Posted

what is an srg name?

 

I have done lots of research but none of the posts that talk about my problem are clear enough for me to understand. Im still a modding newbie

 

Posted

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.

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

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

 

 

Posted
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

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.