Jump to content

Recommended Posts

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

}

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

Posted
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

Posted

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...
Posted (edited)

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

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