Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

I am creating a minecraft mod for 1.20 using forge, but when I came to the creation of a block i had of course the need to import the behaviour of the block with the proprieties, but when i wrote "Block(BlockBehaviour.Properties.of(Material.SLIME)" (since I need the block to be like the slime) Material. is not a recognized symbol and there is no class that imports the Material. Line, has this changed in 1.20 forge? which is the new code for it?

this is the full code I stopped at ".strenght" because of this error

 

package net.nicco.examplemod.block;

import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.registries.RegistryObject;
import net.nicco.examplemod.amber_item.ModItems;
import net.nicco.examplemod.firstmode;
import net.minecraft.world.level.block.Block;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;

import java.util.function.Supplier;

public class ModBlocks {

public static final DeferredRegister<Block> BLOCKS =
DeferredRegister.create(ForgeRegistries.BLOCKS, firstmode.MOD_ID);

private static BlockBehaviour SlimeBlock;
public static final RegistryObject<Block> AMBER_BLOCK = registerBlock("amber_block",
() -> new Block(BlockBehaviour.Properties.of(Material.SLIME)))
.strength

private static <T extends Block> RegistryObject<T> registerBlock(String name, Supplier<T> block) {
RegistryObject<T> toReturn = BLOCKS.register(name, block);
registerBlockItem(name, toReturn);
return toReturn;
};


private static <T extends Block> RegistryObject<Item> registerBlockItem(String name, RegistryObject<T> block) {
return ModItems.ITEMS.register(name, ()-> new BlockItem(block.get(),
new Item.Properties()))
}
public static void register(IEventBus eventBus) {
BLOCKS.register(eventBus);
}

}

  • Author

Yeah If i do this:

import net.minecraft.world.level.material.Material;

then: 

Cannot resolve symbol 'Material'

3 minutes ago, SomePerson said:


import net.minecraft.world.level.material.Material;

 

   public static final Block SLIME_BLOCK = register("slime_block", new SlimeBlock(BlockBehaviour.Properties.of().mapColor(MapColor.GRASS).friction(0.8F).sound(SoundType.SLIME_BLOCK).noOcclusion()));

That was in Blocks.java.

Just do that.

  • Author
On 6/11/2023 at 4:12 PM, SomePerson said:
   public static final Block SLIME_BLOCK = register("slime_block", new SlimeBlock(BlockBehaviour.Properties.of().mapColor(MapColor.GRASS).friction(0.8F).sound(SoundType.SLIME_BLOCK).noOcclusion()));

That was in Blocks.java.

Just do that.

I realized that they modifed the ...Properties.of(MATERIAL.MINECRAFT_BLOCK) into .Properties.copy(Blocks.MIENCRAFT_BLOCK)..:

Thank you anyway

I did not see this:

public class Block extends BlockBehaviour

So I did not know how I could use Properties.copy() which actually requires a BlockBehaviour object.

Sorry for that.

  • 1 month later...

Do you still need help?

Spoiler

Do you still need help? Need assistance with your capstone project? Look no further than this great site GrabMyEssay's capstone project writing service. Their experts will guide you through every step, ensuring your project is well-researched, structured, and impressive.

 

Edited by JonBaker

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

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.