Posted June 11, 20232 yr 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); } }
June 11, 20232 yr Author 6 minutes ago, SomePerson said: You are not importing the Material class. Is that on purpose? I can't find any Class to import for the Material Class tho
June 11, 20232 yr 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;
June 11, 20232 yr 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.
June 13, 20232 yr 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
June 13, 20232 yr 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.
July 14, 20232 yr 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 July 21, 20232 yr 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.