
Somonestolemyusername
Members-
Posts
70 -
Joined
-
Last visited
Everything posted by Somonestolemyusername
-
[SOLVED] [1.16.4] How do I generate ores?
Somonestolemyusername replied to Linky132's topic in Modder Support
so as you see in this code i am making it spawn randomly across the map. just to tell u this is for 1.15 the code in 1.16 is something similar to this this code is just to demonstrate how you would write it. also make a separate java class in ModFolder.world.gen.OreGeneration.java and type in code something like this but dont copy, it wont work in 1.16 and replace RegistryHandler.NETHERITE_ORE with the path to the ore you want to generate thats in your registry handler also then in your main.java class where it has your mod id and stuff in the private void setup(final FMLCommonSetupEvent event) u will write OreGeneration.generate(); in the brackets private static void setupOreGeneration() { for (Biome biome : ForgeRegistries.BIOMES) { biome.addFeature(Decoration.UNDERGROUND_ORES, Feature.ORE .withConfiguration(new OreFeatureConfig(OreFeatureConfig.FillerBlockType.NATURAL_STONE, RegistryHandler.NETHERITE_ORE.get().getDefaultState(), 10)) .withPlacement(Placement.COUNT_RANGE.configure(new CountRangeConfig(20, 5, 0, 128)))); } } public static void generate() { setupOreGeneration(); } -
[SOLVED] [1.16.4] How do I generate ores?
Somonestolemyusername replied to Linky132's topic in Modder Support
ik how -
the ore isint broken it works perfectly its just like the netherite block(the ore did not get deleted) it did not appear in the inv. but when i add block items to the ore it gives an error for OreGeneration.java because its supposed to be RegistryHandler.NETHERITE_ORE.get().getDefaultState(), 10)) and I dont know what i would change it to if i make it with the ItemList.netherite_ore method
-
package com.vicken.mod3.util; import com.vicken.mod3.items.ItemBase; import com.vicken.mod3.items.TeleportStaff; import com.vicken.mod3.list.BlockList; import com.vicken.mod3.list.ItemList; import com.vicken.mod3.list.SoundList; import com.vicken.mod3.my_mod; import net.minecraft.block.Block; import net.minecraft.block.Blocks; import net.minecraft.block.OreBlock; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.entity.layers.ArmorLayer; import net.minecraft.item.*; import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.ToolType; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.RegistryObject; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; import static com.vicken.mod3.my_mod.Mod_ID; public class RegistryHandler<name> { public static final DeferredRegister<Item> ITEMS = new DeferredRegister<>(ForgeRegistries.ITEMS, Mod_ID); public static final DeferredRegister<Block> BLOCKS = new DeferredRegister<>(ForgeRegistries.BLOCKS, Mod_ID); public static void init() { ITEMS.register(FMLJavaModLoadingContext.get().getModEventBus()); BLOCKS.register(FMLJavaModLoadingContext.get().getModEventBus()); } // Items public static final RegistryObject<Item> RUBY = ITEMS.register("ruby", ItemBase::new); public static final RegistryObject<Item> NETHERITE_INGOT = ITEMS.register("netherite_ingot", ItemBase::new); public static final RegistryObject<Item> FRUIT = ITEMS.register("fruit", () -> new Item(new Item.Properties().group(ModItemGroup.instance) .food(new Food.Builder().hunger(4).saturation(2).build()))); public static final RegistryObject<Item> TELEPORT_STAFF = ITEMS.register("teleport_staff", () -> new TeleportStaff(new Item.Properties().group(ModItemGroup.instance).maxDamage(50))); // Blocks public static final RegistryObject<OreBlock> NETHERITE_ORE = BLOCKS.register("netherite_ore", () -> new OreBlock(Block.Properties.from(Blocks.IRON_ORE))); @SubscribeEvent public static void registerBlock(final RegistryEvent.Register<Block> event) { event.getRegistry().registerAll ( BlockList.netherite_block = new Block(Block.Properties.create(Material.IRON).sound(SoundType.METAL)).setRegistryName(location("netherite_block")) ); } @SubscribeEvent public static void registerItems(final RegistryEvent.Register<Item> event) { event.getRegistry().registerAll ( ItemList.netherite_block = new BlockItem(BlockList.netherite_block, new Item.Properties().group(RegistryHandler.ModItemGroup.instance)).setRegistryName(BlockList.netherite_block.getRegistryName()) ); } public static ResourceLocation location(String name) { return new ResourceLocation(Mod_ID, name); } //Discs public static final RegistryObject<Item> BEN10_MUSIC_DISC = ITEMS.register("ben10_disc", () -> new MusicDiscItem(1, SoundList.BEN10_DISC_LAZY, new Item.Properties().maxStackSize(1).group(ModItemGroup.instance))); //Armor // a new creative tab public static class ModItemGroup extends ItemGroup { public static final ModItemGroup instance = new ModItemGroup(ItemGroup.GROUPS.length, "ExtrasMod"); private ModItemGroup(int index, String label) { super(index, label); } @Override public ItemStack createIcon() { return new ItemStack(RUBY.get()); } } }
-
the code is.down below. Also since I changed the code my Ore generation.java has errors. @SubscribeEvent public static void registerBlock(final RegistryEvent.Register<Block> event) { event.getRegistry().registerAll ( BlockList.netherite_block = new Block(Block.Properties.create(Material.IRON).sound(SoundType.METAL)).setRegistryName(location("netherite_block")) ); } @SubscribeEvent public static void registerItems(final RegistryEvent.Register<Item> event) { event.getRegistry().registerAll ( ItemList.netherite_block = new BlockItem(BlockList.netherite_block, new Item.Properties().group(RegistryHandler.ModItemGroup.instance)).setRegistryName(
-
i tried but it gave me and error saying Required Type: block Provided: RegistryObject <net.minecraft.block.Block> @SubscribeEvent public static void registerItems(final RegistryEvent.Register<Item> event) { { event.getRegistry().registerAll ( ItemList.netherite_block = new BlockItem(RegistryHandler.NETHERITE_BLOCK, new Item.Properties().group(RegistryHandler.ModItemGroup.instance)).setRegistryName(RegistryHandler.NETHERITE_BLOCK.getRegistryName()) ); }