Jump to content

Gianka1485

Members
  • Posts

    56
  • Joined

  • Last visited

Everything posted by Gianka1485

  1. Can someone please tell me what I'm doing wrong? The truth is that this new generation of minecraft ores confuses me a lot, it changed a lot since 1.17...
  2. Here is my code: GWorld Main: package jp.gianka.gworld; import jp.gianka.gworld.elements.blocks.GWorldBlocks; import jp.gianka.gworld.elements.items.GWorldItems; import jp.gianka.gworld.elements.tab.GWorldTab; import jp.gianka.gworld.elements.world.ore.OreGeneration; import jp.gianka.gworld.elements.world.ore.OrePlacements; import net.minecraft.world.item.CreativeModeTab; import net.minecraft.world.level.block.Blocks; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @Mod(GWorld.MODID) public class GWorld { public static final String MODID = "gworld"; private static final Logger LOGGER = LogManager.getLogger(); public static final CreativeModeTab gworld = new GWorldTab(); public GWorld() { IEventBus eventBus = FMLJavaModLoadingContext.get().getModEventBus(); GWorldBlocks.BLOCKS.register(eventBus); GWorldItems.ITEMS.register(eventBus); eventBus.addListener(this::setup); MinecraftForge.EVENT_BUS.register(this); } private void setup(final FMLCommonSetupEvent event) { event.enqueueWork(() -> { OreGeneration.registerConfiguredFeatures(); OrePlacements.registerPlacedFeatures(); }); LOGGER.info(Blocks.DIRT.getRegistryName()); } } Register blocks: package jp.gianka.gworld.elements.blocks; import jp.gianka.gworld.GWorld; import net.minecraft.util.valueproviders.UniformInt; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.OreBlock; import net.minecraft.world.level.block.SoundType; import net.minecraft.world.level.block.state.BlockBehaviour.Properties; import net.minecraft.world.level.material.Material; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; import net.minecraftforge.registries.RegistryObject; public class GWorldBlocks { public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, GWorld.MODID); public static final RegistryObject<Block> DEEPSLATE_KYPTOITE_ORE = BLOCKS.register("deepslate_kyptoite_ore", () -> new OreBlock(Properties.of(Material.STONE).strength(15F, 1500F).requiresCorrectToolForDrops().lightLevel((state) -> { return 15; }).sound(SoundType.DEEPSLATE), UniformInt.of(25, 50))); public static final RegistryObject<Block> KYPTOITE_ORE = BLOCKS.register("kyptoite_ore", () -> new OreBlock(Properties.of(Material.STONE).strength(15F, 1500F).requiresCorrectToolForDrops().lightLevel((state) -> { return 15; }).sound(SoundType.STONE), UniformInt.of(25, 50))); } Register Items: package jp.gianka.gworld.elements.items; import jp.gianka.gworld.GWorld; import jp.gianka.gworld.elements.blocks.GWorldBlocks; import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.Item; import net.minecraft.world.item.Item.Properties; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; import net.minecraftforge.registries.RegistryObject; public class GWorldItems { public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, GWorld.MODID); public static final RegistryObject<Item> DEEPSLATE_KYPTOITE_ORE = ITEMS.register("deepslate_kyptoite_ore", () -> new BlockItem(GWorldBlocks.DEEPSLATE_KYPTOITE_ORE.get(), (new Properties()).tab(GWorld.gworld))); public static final RegistryObject<Item> KYPTOITE_GEM = ITEMS.register("kyptoite_gem", () -> new Item((new Properties()).tab(GWorld.gworld))); public static final RegistryObject<Item> KYPTOITE_ORE = ITEMS.register("kyptoite_ore", () -> new BlockItem(GWorldBlocks.KYPTOITE_ORE.get(), (new Properties()).tab(GWorld.gworld))); } Ore generation features: package jp.gianka.gworld.elements.world.ore; import jp.gianka.gworld.GWorld; import jp.gianka.gworld.elements.blocks.GWorldBlocks; import net.minecraft.core.Registry; import net.minecraft.data.BuiltinRegistries; import net.minecraft.data.worldgen.features.OreFeatures; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.levelgen.feature.ConfiguredFeature; import net.minecraft.world.level.levelgen.feature.Feature; import net.minecraft.world.level.levelgen.feature.configurations.OreConfiguration; import net.minecraft.world.level.levelgen.feature.configurations.OreConfiguration.TargetBlockState; import net.minecraftforge.fml.common.Mod.EventBusSubscriber; import java.util.List; @EventBusSubscriber public class OreGeneration { public static final List<TargetBlockState> ORE_KYPTOITE_TARGET_LIST = List.of(OreConfiguration.target(OreFeatures.STONE_ORE_REPLACEABLES, GWorldBlocks.KYPTOITE_ORE.get().defaultBlockState()), OreConfiguration.target(OreFeatures.DEEPSLATE_ORE_REPLACEABLES, GWorldBlocks.DEEPSLATE_KYPTOITE_ORE.get().defaultBlockState())); public static final ConfiguredFeature<?, ?> ORE_KYPTOITE_SMALL = Feature.ORE.configured(new OreConfiguration(ORE_KYPTOITE_TARGET_LIST, 4, 0.5F)); public static final ConfiguredFeature<?, ?> ORE_KYPTOITE_LARGE = Feature.ORE.configured(new OreConfiguration(ORE_KYPTOITE_TARGET_LIST, 12, 0.7F)); public static final ConfiguredFeature<?, ?> ORE_KYPTOITE_BURIED = Feature.ORE.configured(new OreConfiguration(ORE_KYPTOITE_TARGET_LIST, 8, 1.0F)); public static void registerConfiguredFeatures() { Registry.register(BuiltinRegistries.CONFIGURED_FEATURE, new ResourceLocation(GWorld.MODID, "ore_kyptoite_small"), ORE_KYPTOITE_SMALL); Registry.register(BuiltinRegistries.CONFIGURED_FEATURE, new ResourceLocation(GWorld.MODID, "ore_kyptoite_large"), ORE_KYPTOITE_LARGE); Registry.register(BuiltinRegistries.CONFIGURED_FEATURE, new ResourceLocation(GWorld.MODID, "ore_kyptoite_buried"), ORE_KYPTOITE_BURIED); } } Ore placements features: package jp.gianka.gworld.elements.world.ore; import jp.gianka.gworld.GWorld; import net.minecraft.core.Registry; import net.minecraft.data.BuiltinRegistries; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.levelgen.GenerationStep.Decoration; import net.minecraft.world.level.levelgen.VerticalAnchor; import net.minecraft.world.level.levelgen.placement.*; import net.minecraftforge.event.world.BiomeLoadingEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod.EventBusSubscriber; import java.util.List; @EventBusSubscriber public class OrePlacements { public static final PlacedFeature ORE_KYPTOITE_SMALL = OreGeneration.ORE_KYPTOITE_SMALL.placed(commonOrePlacement(7, HeightRangePlacement.triangle(VerticalAnchor.aboveBottom(-80), VerticalAnchor.aboveBottom(80)))); public static final PlacedFeature ORE_KYPTOITE_LARGE = OreGeneration.ORE_KYPTOITE_LARGE.placed(rareOrePlacement(9, HeightRangePlacement.triangle(VerticalAnchor.aboveBottom(-80), VerticalAnchor.aboveBottom(80)))); public static final PlacedFeature ORE_KYPTOITE_BURIED = OreGeneration.ORE_KYPTOITE_BURIED.placed(commonOrePlacement(4, HeightRangePlacement.triangle(VerticalAnchor.aboveBottom(-80), VerticalAnchor.aboveBottom(80)))); public static void registerPlacedFeatures() { Registry.register(BuiltinRegistries.PLACED_FEATURE, new ResourceLocation(GWorld.MODID, "ore_kyptoite_small"), ORE_KYPTOITE_SMALL); Registry.register(BuiltinRegistries.PLACED_FEATURE, new ResourceLocation(GWorld.MODID, "ore_kyptoite_large"), ORE_KYPTOITE_LARGE); Registry.register(BuiltinRegistries.PLACED_FEATURE, new ResourceLocation(GWorld.MODID, "ore_kyptoite_buried"), ORE_KYPTOITE_BURIED); } @SubscribeEvent public static void registerBiomeModification(BiomeLoadingEvent event) { if (true) { event.getGeneration().getFeatures(Decoration.UNDERGROUND_ORES).add(() -> { return ORE_KYPTOITE_SMALL; }); } if (true) { event.getGeneration().getFeatures(Decoration.UNDERGROUND_ORES).add(() -> { return ORE_KYPTOITE_LARGE; }); } if (true) { event.getGeneration().getFeatures(Decoration.UNDERGROUND_ORES).add(() -> { return ORE_KYPTOITE_BURIED; }); } } private static List<PlacementModifier> orePlacement(PlacementModifier count, PlacementModifier height) { return List.of(count, InSquarePlacement.spread(), height, BiomeFilter.biome()); } private static List<PlacementModifier> commonOrePlacement(int count, PlacementModifier height) { return orePlacement(CountPlacement.of(count), height); } private static List<PlacementModifier> rareOrePlacement(int rarityCount, PlacementModifier height) { return orePlacement(RarityFilter.onAverageOnceEvery(rarityCount), height); } }
  3. I already registered the OreGeneration and OrePlacements classes, but now I get the following error: ---- Minecraft Crash Report ---- // Why did you do that? Time: 7/2/22 03:04 Description: Mod loading error has occurred java.lang.Exception: Mod Loading has failed at net.minecraftforge.logging.CrashReportExtender.dumpModLoadingCrashReport(CrashReportExtender.java:69) ~[forge-1.18.1-39.0.66_mapped_parchment_2022.01.23-1.18.1.jar%2376%2382!/:?] {re:classloading} at net.minecraftforge.client.loading.ClientModLoader.completeModLoading(ClientModLoader.java:183) ~[forge-1.18.1-39.0.66_mapped_parchment_2022.01.23-1.18.1.jar%2376%2382!/:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.client.Minecraft.lambda$new$1(Minecraft.java:553) ~[forge-1.18.1-39.0.66_mapped_parchment_2022.01.23-1.18.1.jar%2377!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.Util.ifElse(Util.java:409) ~[forge-1.18.1-39.0.66_mapped_parchment_2022.01.23-1.18.1.jar%2377!/:?] {re:classloading} at net.minecraft.client.Minecraft.lambda$new$2(Minecraft.java:547) ~[forge-1.18.1-39.0.66_mapped_parchment_2022.01.23-1.18.1.jar%2377!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.gui.screens.LoadingOverlay.render(LoadingOverlay.java:135) ~[forge-1.18.1-39.0.66_mapped_parchment_2022.01.23-1.18.1.jar%2377!/:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.client.renderer.GameRenderer.render(GameRenderer.java:875) ~[forge-1.18.1-39.0.66_mapped_parchment_2022.01.23-1.18.1.jar%2377!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.Minecraft.runTick(Minecraft.java:1040) ~[forge-1.18.1-39.0.66_mapped_parchment_2022.01.23-1.18.1.jar%2377!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.Minecraft.run(Minecraft.java:660) ~[forge-1.18.1-39.0.66_mapped_parchment_2022.01.23-1.18.1.jar%2377!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.main.Main.main(Main.java:205) ~[forge-1.18.1-39.0.66_mapped_parchment_2022.01.23-1.18.1.jar%2377!/:?] {re:classloading,pl:runtimedistcleaner:A} at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] {} at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?] {} at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] {} at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?] {} at net.minecraftforge.fml.loading.targets.ForgeClientUserdevLaunchHandler.lambda$launchService$0(ForgeClientUserdevLaunchHandler.java:38) ~[fmlloader-1.18.1-39.0.66.jar%230!/:?] {} at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-9.1.0.jar%2310!/:?] {} at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53) [modlauncher-9.1.0.jar%2310!/:?] {} at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71) [modlauncher-9.1.0.jar%2310!/:?] {} at cpw.mods.modlauncher.Launcher.run(Launcher.java:106) [modlauncher-9.1.0.jar%2310!/:?] {} at cpw.mods.modlauncher.Launcher.main(Launcher.java:77) [modlauncher-9.1.0.jar%2310!/:?] {} at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) [modlauncher-9.1.0.jar%2310!/:?] {} at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) [modlauncher-9.1.0.jar%2310!/:?] {} at cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:149) [bootstraplauncher-1.0.0.jar:?] {} A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Thread: Render thread Stacktrace: at java.util.Objects.requireNonNull(Objects.java:334) ~[?:?] {} -- MOD gworld -- Details: Caused by 0: java.lang.ExceptionInInitializerError at java.lang.Class.forName0(Native Method) ~[?:?] {} at java.lang.Class.forName(Class.java:467) ~[?:?] {} at net.minecraftforge.fml.javafmlmod.AutomaticEventSubscriber.lambda$inject$6(AutomaticEventSubscriber.java:75) ~[javafmllanguage-1.18.1-39.0.66.jar%2378!/:?] {} at java.util.ArrayList.forEach(ArrayList.java:1511) ~[?:?] {} at net.minecraftforge.fml.javafmlmod.AutomaticEventSubscriber.inject(AutomaticEventSubscriber.java:62) ~[javafmllanguage-1.18.1-39.0.66.jar%2378!/:?] {} at net.minecraftforge.fml.javafmlmod.FMLModContainer.constructMod(FMLModContainer.java:91) ~[javafmllanguage-1.18.1-39.0.66.jar%2378!/:?] {} at net.minecraftforge.fml.ModContainer.lambda$buildTransitionHandler$4(ModContainer.java:120) ~[fmlcore-1.18.1-39.0.66.jar%2380!/:?] {} at java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1804) ~[?:?] {} at java.util.concurrent.CompletableFuture$AsyncRun.exec(CompletableFuture.java:1796) ~[?:?] {} at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373) ~[?:?] {} at java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182) ~[?:?] {} at java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655) ~[?:?] {} at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622) ~[?:?] {} at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165) ~[?:?] {} Mod File: main Failure message: GWorld Mod (gworld) has failed to load correctly java.lang.ExceptionInInitializerError: null Mod Version: 0.0.0.3 Mod Issue URL: NOT PROVIDED Exception message: java.lang.NullPointerException: Registry Object not present: gworld:kyptoite_ore Stacktrace: at java.util.Objects.requireNonNull(Objects.java:334) ~[?:?] {} at net.minecraftforge.registries.RegistryObject.get(RegistryObject.java:116) ~[forge-1.18.1-39.0.66_mapped_parchment_2022.01.23-1.18.1.jar%2376%2382!/:?] {re:classloading} at jp.gianka.gworld.elements.world.ore.OreGeneration.<clinit>(OreGeneration.java:20) ~[%2381!/:?] {re:classloading} at java.lang.Class.forName0(Native Method) ~[?:?] {} at java.lang.Class.forName(Class.java:467) ~[?:?] {} at net.minecraftforge.fml.javafmlmod.AutomaticEventSubscriber.lambda$inject$6(AutomaticEventSubscriber.java:75) ~[javafmllanguage-1.18.1-39.0.66.jar%2378!/:?] {} at java.util.ArrayList.forEach(ArrayList.java:1511) ~[?:?] {} at net.minecraftforge.fml.javafmlmod.AutomaticEventSubscriber.inject(AutomaticEventSubscriber.java:62) ~[javafmllanguage-1.18.1-39.0.66.jar%2378!/:?] {} at net.minecraftforge.fml.javafmlmod.FMLModContainer.constructMod(FMLModContainer.java:91) ~[javafmllanguage-1.18.1-39.0.66.jar%2378!/:?] {} at net.minecraftforge.fml.ModContainer.lambda$buildTransitionHandler$4(ModContainer.java:120) ~[fmlcore-1.18.1-39.0.66.jar%2380!/:?] {} at java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1804) ~[?:?] {} at java.util.concurrent.CompletableFuture$AsyncRun.exec(CompletableFuture.java:1796) ~[?:?] {} at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373) ~[?:?] {} at java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182) ~[?:?] {} at java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655) ~[?:?] {} at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622) ~[?:?] {} at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165) ~[?:?] {} -- System Details -- Details: Minecraft Version: 1.18.1 Minecraft Version ID: 1.18.1 Operating System: Windows 10 (amd64) version 10.0 Java Version: 17.0.2, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode, sharing), Oracle Corporation Memory: 920854528 bytes (878 MiB) / 1342177280 bytes (1280 MiB) up to 25769803776‬ bytes (24576‬ MiB) CPUs: 32 Processor Vendor: AuthenticAMD Processor Name: AMD Processor Model Unknown Identifier: AuthenticAMD Family 16 Model 10 Stepping 0 Microarchitecture: ZEN3 Frequency (GHz): 4.61 Number of physical packages: 1 Number of physical CPUs: 32 Number of logical CPUs: 64 Graphics card #0 name: NVIDIA GeForce RTX™ 3090 Series Graphics card #0 vendor: Nvidia Corporation, Inc. (0x1002) Graphics card #0 VRAM (MB): 24576.00 Graphics card #0 deviceId: 0x6939 Graphics card #0 versionInfo: DriverVersion=511.65 Memory slot #0 capacity (MB): 16384.00 Memory slot #0 clockSpeed (GHz): 4.00 Memory slot #0 type: DDR4 Memory slot #1 capacity (MB): 16384.00 Memory slot #1 clockSpeed (GHz): 4.00 Memory slot #1 type: DDR4 Memory slot #2 capacity (MB): 16384.00 Memory slot #2 clockSpeed (GHz): 4.00 Memory slot #2 type: DDR4 Memory slot #3 capacity (MB): 16384.00 Memory slot #3 clockSpeed (GHz): 4.00 Memory slot #3 type: DDR4 Virtual memory max (MB): 13234.48 Virtual memory used (MB): 10920.84 Swap memory total (MB): 5044.36 Swap memory used (MB): 554.34 JVM Flags: 1 total; -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump ModLauncher: 9.1.0+9.1.0+main.6690ee51 ModLauncher launch target: forgeclientuserdev ModLauncher naming: mcp ModLauncher services: mixin PLUGINSERVICE eventbus PLUGINSERVICE object_holder_definalize PLUGINSERVICE runtime_enum_extender PLUGINSERVICE capability_token_subclass PLUGINSERVICE accesstransformer PLUGINSERVICE runtimedistcleaner PLUGINSERVICE mixin TRANSFORMATIONSERVICE fml TRANSFORMATIONSERVICE FML Language Providers: minecraft@1.0 javafml@null Mod List: forge-1.18.1-39.0.66_mapped_parchment_2022.01.23-1|Minecraft |minecraft |1.18.1 |COMMON_SET|Manifest: a1:d4:5e:04:4f:d3:d6:e0:7b:37:97:cf:77:b0:de:ad:4a:47:ce:8c:96:49:5f:0a:cf:8c:ae:b2:6d:4b:8a:3f |Forge |forge |39.0.66 |COMMON_SET|Manifest: NOSIGNATURE main |GWorld Mod |gworld |0.0.0.3 |ERROR |Manifest: NOSIGNATURE Crash Report UUID: f07ddca9-6d6b-45e6-950a-30ba0713c8db FML: 39.0 Forge: net.minecraftforge:39.0.66
  4. As the title says, I have tried from practically meaningless code to copying minecraft code itself, and nothing works, Minecraft does not crash, but no ore is generated, everything works except that no ore is generated. The main class here: package jp.gianka.gworld; import jp.gianka.gworld.elements.blocks.GWorldBlocks; import jp.gianka.gworld.elements.items.GWorldItems; import jp.gianka.gworld.elements.tab.GWorldTab; import jp.gianka.gworld.elements.world.ores.OreGeneration; import jp.gianka.gworld.elements.world.ores.OrePlacements; import net.minecraft.world.item.CreativeModeTab; import net.minecraft.world.level.block.Blocks; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @Mod(GWorld.MODID) public class GWorld { public static final String MODID = "gworld"; private static final Logger LOGGER = LogManager.getLogger(); public static final CreativeModeTab gworld = new GWorldTab(); public GWorld() { IEventBus eventBus = FMLJavaModLoadingContext.get().getModEventBus(); GWorldBlocks.BLOCKS.register(eventBus); GWorldItems.ITEMS.register(eventBus); eventBus.addListener(this::setup); MinecraftForge.EVENT_BUS.register(this); } private void setup(final FMLCommonSetupEvent event) { OreGeneration.registerFeatures(); OrePlacements.registerPlacements(); LOGGER.info("Dirt Block >> {}", Blocks.DIRT.getRegistryName()); } } OreGeneration: package jp.gianka.gworld.elements.world.ores; import jp.gianka.gworld.GWorld; import jp.gianka.gworld.elements.blocks.GWorldBlocks; import net.minecraft.core.Registry; import net.minecraft.data.BuiltinRegistries; import net.minecraft.data.worldgen.features.OreFeatures; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.levelgen.feature.ConfiguredFeature; import net.minecraft.world.level.levelgen.feature.Feature; import net.minecraft.world.level.levelgen.feature.configurations.OreConfiguration; import net.minecraft.world.level.levelgen.feature.configurations.OreConfiguration.TargetBlockState; import java.util.List; public class OreGeneration { public static List<TargetBlockState> ORE_KYPTOITE_TARGET_LIST = List.of(OreConfiguration.target(OreFeatures.STONE_ORE_REPLACEABLES, GWorldBlocks.KYPTOITE_ORE.get().defaultBlockState()), OreConfiguration.target(OreFeatures.DEEPSLATE_ORE_REPLACEABLES, GWorldBlocks.DEEPSLATE_KYPTOITE_ORE.get().defaultBlockState())); public static ConfiguredFeature<?, ?> ORE_KYPTOITE = Feature.ORE.configured(new OreConfiguration(ORE_KYPTOITE_TARGET_LIST, 16)); public static void registerFeatures() { Registry.register(BuiltinRegistries.CONFIGURED_FEATURE, new ResourceLocation(GWorld.MODID, "ore_kyptoite_small"), ORE_KYPTOITE); } } OrePlacements: package jp.gianka.gworld.elements.world.ores; import jp.gianka.gworld.GWorld; import net.minecraft.core.Registry; import net.minecraft.data.BuiltinRegistries; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.levelgen.GenerationStep.Decoration; import net.minecraft.world.level.levelgen.VerticalAnchor; import net.minecraft.world.level.levelgen.placement.*; import net.minecraftforge.event.world.BiomeLoadingEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import java.util.List; public class OrePlacements { public static PlacedFeature ORE_KYPTOITE = OreGeneration.ORE_KYPTOITE.placed(commonOrePlacement(32, HeightRangePlacement.triangle(VerticalAnchor.absolute(-64), VerticalAnchor.absolute(16)))); private static List<PlacementModifier> orePlacement(PlacementModifier count, PlacementModifier height) { return List.of(count, InSquarePlacement.spread(), height, BiomeFilter.biome()); } private static List<PlacementModifier> commonOrePlacement(int count, PlacementModifier height) { return orePlacement(CountPlacement.of(count), height); } private static List<PlacementModifier> rareOrePlacement(int count, PlacementModifier height) { return orePlacement(RarityFilter.onAverageOnceEvery(count), height); } public static void registerPlacements() { Registry.register(BuiltinRegistries.PLACED_FEATURE, new ResourceLocation(GWorld.MODID, "ore_kyptoite_small"), ORE_KYPTOITE); } @SubscribeEvent public static void registerBiomeModification(BiomeLoadingEvent event) { if (true) { event.getGeneration().getFeatures(Decoration.UNDERGROUND_ORES).add(() -> ORE_KYPTOITE); } } } Blocks: package jp.gianka.gworld.elements.blocks; import jp.gianka.gworld.GWorld; import net.minecraft.util.valueproviders.UniformInt; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.OreBlock; import net.minecraft.world.level.block.SoundType; import net.minecraft.world.level.block.state.BlockBehaviour.Properties; import net.minecraft.world.level.material.Material; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; import net.minecraftforge.registries.RegistryObject; public class GWorldBlocks { public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, GWorld.MODID); public static final RegistryObject<OreBlock> DEEPSLATE_KYPTOITE_ORE = BLOCKS.register("deepslate_kyptoite_ore", () -> new OreBlock(Properties.of(Material.STONE).strength(15F, 1500F).requiresCorrectToolForDrops().lightLevel((state) -> { return 15; }).sound(SoundType.DEEPSLATE), UniformInt.of(20,50))); public static final RegistryObject<OreBlock> KYPTOITE_ORE = BLOCKS.register("kyptoite_ore", () -> new OreBlock(Properties.of(Material.STONE).strength(15F, 1500F).requiresCorrectToolForDrops().lightLevel((state) -> { return 15; }).sound(SoundType.STONE), UniformInt.of(20, 50))); } Please someone tell me what I'm doing wrong.... :'c
  5. When you want a block to have a texture, it must have the following information (although it may vary): { "parent": "examplemod:block/example_block" }
  6. I was in the bathroom so I couldn't respond quickly, hahaha... I think the problem may come from the .json files of assets /% modid% / models / item
  7. I think you should do it the old way, you should register the item in the items initializer, example: public class GWorldItems { public static final DeferredRegister<Item> ITEMS; public static final RegistryObject<Item> EXAMPLE_DUST; public static final RegistryObject<Item> EXAMPLE_GEM; public static final RegistryObject<Item> EXAMPLE_BLOCK; static { ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, "examplemod"); EXAMPLE_DUST = ITEMS.register("example_dust", () -> { return new Item((new Properties()).tab(ExampleMod.examplemod)); }); EXAMPLE_GEM = ITEMS.register("example_gem", () -> { return new Item((new Properties()).tab(ExampleMod.examplemod)); }); EXAMPLE_BLOCK = ITEMS.register("example_ore", () -> { return new BlockItem((Block) ExampleBlocks.EXAMPLE_ORE.get(), (new Properties()).tab(ExampleMod.examplemod)); }); } } This is how it has always worked and will always work.
  8. But I remember some mods, which added that type of textures, I think I'll look inside their files, to see how they do it ...
  9. Just in case, the configuration files: The ExampleArmorTiers: public enum ExampleArmorMaterials implements ArmorMaterial { EXAMPLE("example", 200, new int[]{4, 7, 9, 4}, 30, SoundEvents.ARMOR_EQUIP_DIAMOND, 4.0F, 0.2F, () -> { return Ingredient.of(new ItemLike[]{(ItemLike) ExampleItems.EXAMPLE_GEM.get()}); }); private static final int[] baseDurability = new int[]{13, 15, 16, 11}; private final String name; private final int durabilityMultiplier; private final int[] slotProtections; private final int enchantmentValue; private final SoundEvent sound; private final float toughness; private final float knockBackResistance; private final Ingredient repairIngredient; private ExampleArmorMaterials(String name, int durabilityMultiplier, int[] defenseForSlot, int enchantmentValue, SoundEvent equipSound, float toughness, float knockBackResistance, Supplier<Ingredient> repairIngredient) { this.name = name; this.durabilityMultiplier = durabilityMultiplier; this.slotProtections = defenseForSlot; this.enchantmentValue = enchantmentValue; this.sound = equipSound; this.toughness = toughness; this.knockBackResistance = knockBackResistance; this.repairIngredient = (Ingredient) repairIngredient.get(); } public int getDurabilityForSlot(EquipmentSlot slot) { return baseDurability[slot.getIndex()] * this.durabilityMultiplier; } public int getDefenseForSlot(EquipmentSlot slot) { return this.slotProtections[slot.getIndex()]; } public int getEnchantmentValue() { return this.enchantmentValue; } public SoundEvent getEquipSound() { return this.sound; } public Ingredient getRepairIngredient() { return this.repairIngredient; } public String getName() { return ExampleMod.modid + ":" + this.name; } public float getToughness() { return this.toughness; } public float getKnockbackResistance() { return this.knockBackResistance; } } And the ExampleItems: public class ExampleItems { public static final DeferredRegister<Item> ITEMS; public static final RegistryObject<Item> EXAMPLE_DUST; public static final RegistryObject<Item> EXAMPLE_GEM; public static final RegistryObject<Item> EXAMPLE_ORE; public static final RegistryObject<ArmorItem> EXAMPLE_HELMET; public static final RegistryObject<ArmorItem> EXAMPLE_CHESTPLATE; public static final RegistryObject<ArmorItem> EXAMPLE_LEGGINGS; public static final RegistryObject<ArmorItem> EXAMPLE_BOOTS; public static final RegistryObject<AxeItem> EXAMPLE_AXE; public static final RegistryObject<HoeItem> EXAMPLE_HOE; public static final RegistryObject<PickaxeItem> EXAMPLE_PICKAXE; public static final RegistryObject<ShovelItem> EXAMPLE_SHOVEL; public static final RegistryObject<SwordItem> EXAMPLE_SWORD; static { ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, "examplemod"); EXAMPLE_DUST = ITEMS.register("example_dust", () -> { return new Item((new Properties()).tab(ExampleMod.examplemod)); }); EXAMPLE_GEM = ITEMS.register("example_gem", () -> { return new Item((new Properties()).tab(ExampleMod.examplemod)); }); EXAMPLE_ORE = ITEMS.register("example_ore", () -> { return new BlockItem((Block) ExampleBlocks.EXAMPLE_ORE.get(), (new Properties()).tab(ExampleMod.examplemod)); }); EXAMPLE_HELMET = ITEMS.register("example_helmet", () -> { return new ArmorItem(ExampleArmorMaterials.EXAMPLE, EquipmentSlot.HEAD, (new Properties()).tab(ExampleMod.examplemod)); }); EXAMPLE_CHESTPLATE = ITEMS.register("example_chestplate", () -> { return new ArmorItem(ExampleArmorMaterials.EXAMPLE, EquipmentSlot.CHEST, (new Properties()).tab(ExampleMod.examplemod)); }); EXAMPLE_LEGGINGS = ITEMS.register("example_leggings", () -> { return new ArmorItem(ExampleArmorMaterials.EXAMPLE, EquipmentSlot.LEGS, (new Properties()).tab(ExampleMod.examplemod)); }); EXAMPLE_BOOTS = ITEMS.register("example_boots", () -> { return new ArmorItem(ExampleArmorMaterials.EXAMPLE, EquipmentSlot.FEET, (new Properties()).tab(ExampleMod.examplemod)); }); EXAMPLE_AXE = ITEMS.register("example_axe", () -> { return new AxeItem(ExampleTiers.EXAMPLE_TOOL, 5.0F, -3.0F, (new Properties()).tab(ExampleMod.examplemod)); }); EXAMPLE_HOE = ITEMS.register("example_hoe", () -> { return new HoeItem(ExampleTiers.EXAMPLE_TOOL, -5, 0.0F, (new Properties()).tab(ExampleMod.examplemod)); }); EXAMPLE_PICKAXE = ITEMS.register("example_pickaxe", () -> { return new PickaxeItem(ExampleTiers.EXAMPLE_TOOL, 1, -2.8F, (new Properties()).tab(ExampleMod.examplemod)); }); EXAMPLE_SHOVEL = ITEMS.register("example_shovel", () -> { return new ShovelItem(ExampleTiers.EXAMPLE_TOOL, 1.5F, -3.0F, (new Properties()).tab(ExampleMod.examplemod)); }); EXAMPLE_SWORD = ITEMS.register("example_sword", () -> { return new SwordItem(ExampleTiers.EXAMPLE_TOOL, 3, -2.4F, (new Properties()).tab(ExampleMod.examplemod)); }); } }
  10. I made an armor which I want to change color, but when adding the texture, the texture in the game is bugged, not as if there is no texture, and obviously it does not change color, I think it is a problem with the .mcmeta files for animated textures, since if I change the texture to a normal one without animation then it works fine within the game. The .mcmeta files: { "animation": { "frametime": 1, "interpolate": false, "frames": [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ] } }
  11. I already explained to him in another thread, and he no longer has errors, it seems that they failed to tell him what information to put in "pickaxe.json" ... hahaha
  12. What surprised me the most was that it was using the same code that minecraft vanilla used, and it still crashed.
  13. After doing what diesieben07 said, the problem still continued, so I thought "what if we change the position of the axe variable so that it is not the first to be registered?" and boom, solved ...
  14. But it only happens with the ax, everything else works fine, the sword, the shovel, the pick, the hoe, I'm going to test what you say, see how it goes ...
  15. You must register the name of the object in your lang file, the id of the item and then the translation, example: { "block.examplemod.example_block": "Example block", "item.examplemod.example_item": "Example item", "itemgroup.examplemod": "Example Mod" } These are examples of translating a block, an item and a group of items in creative mode respectively. Lang files are normally named after the language type, for example, for US English it would be en_us.json, for English for England en_uk.json, for Spanish for Spain it would be es_es.json, you can find several examples if you unzip the file from version 1.17.1.jar, in practically the same folder, lang.
  16. I will do that, thank you very much, by the way, did it work?
  17. I'm also a very newbie, my programming knowledge is almost nil (or so it was before), I spent a whole month deciphering how variables, classes, int and float values worked, and other things, and after that, now I understand pretty good most of the code, but it was like 2 weeks trying to make an ore appear in the world, hahaha ... The good thing is that I am someone that if you explain with an example he will understand almost immediately, so I It seems good to explain to others, so that they do not go through the same difficulties that I went through ... haha
  18. You have to put as a value inside the files, it has to be in your case: mdg:ruby_block That is, your mod id followed by a colon ":" to then put the name of the object or block (Or the id of the item)
  19. I just opened a thread about that but no one has replied yet and I really don't know what to do ... haha
  20. By the way, in your case, you have the block registered in BlockInit, and I called it ModBlocks, forgive the confusion.
  21. But I think this can lead to problems later, such as problems creating tools.
  22. Delete it and leave it like this: @SubscribeEvent public static void registerItems(final RegistryEvent.Register<Item> event) { LOGGER.info("Hello from Register Item"); } The variable "LOGGER" only serves to guide me, so it is not necessary.
×
×
  • Create New...

Important Information

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