Jump to content

Gianka1485

Members
  • Posts

    57
  • Joined

  • Last visited

Everything posted by Gianka1485

  1. I am working on the 1.17.1 Forge 37.0.34.
  2. I have been working on a mod which adds minerals, the problem is that when they are generated, they ignore the maximum and minimum height that is established. The main: @Mod("examplemod") public class ExampleMod { public static ExampleMod instance; public static final String modid = "examplemod"; private static final Logger LOGGER = LogManager.getLogger("examplemod"); public static final CreativeModeTab examplemod = new ExampleTab(); public ExampleMod() { instance = this; ExampleBlocks.BLOCKS.register(FMLJavaModLoadingContext.get().getModEventBus()); ExampleItems.ITEMS.register(FMLJavaModLoadingContext.get().getModEventBus()); FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup); FMLJavaModLoadingContext.get().getModEventBus().addListener(this::clientSetup); ModLoadingContext.get().registerConfig(Type.COMMON, ExampleModConfig.SPEC, "example-common.toml"); MinecraftForge.EVENT_BUS.addListener(EventPriority.HIGH, OreGeneration::generateOres); MinecraftForge.EVENT_BUS.register(this); } private void setup(final FMLCommonSetupEvent event) { LOGGER.info("Hello from preinit"); LOGGER.info("Dirt block >> {}", Blocks.DIRT.getRegistryName()); } @OnlyIn(Dist.CLIENT) public void clientSetup(FMLClientSetupEvent event) { LOGGER.info("Hello from client setup"); } @SubscribeEvent public void serverStarting(FMLServerStartingEvent event) { LOGGER.info("Hello from server starting"); } @EventBusSubscriber(bus = Bus.MOD) public static class RegistryEvents { public RegistryEvents() { } @SubscribeEvent public static void registerBlocks(final RegistryEvent.Register<Block> event) { LOGGER.info("Hello from Register Block"); } @SubscribeEvent public static void registerItems(final RegistryEvent.Register<Item> event) { LOGGER.info("Hello from Register Item"); } @SubscribeEvent public static void registerEntities(final RegistryEvent.Register<EntityType<?>> event) { LOGGER.info("Hello from Register Entity"); } @SubscribeEvent public static void registerEnchantments(final RegistryEvent.Register<Enchantment> event) { LOGGER.info("Hello from Register Enchantment"); } @SubscribeEvent public static void registerSounds(final RegistryEvent.Register<SoundEvent> event) { LOGGER.info("Hello from Register Sound"); } } } OreGeneration: public class OreGeneration { public OreGeneration() { } public static void generateOres(final BiomeLoadingEvent event) { if (!event.getCategory().equals(Biome.BiomeCategory.NETHER) && !event.getCategory().equals(Biome.BiomeCategory.THEEND)) { exampleOreGenerate(event.getGeneration(), Predicates.NATURAL_STONE, ((Block) ExampleBlocks.EXAMPLE_ORE.get()).defaultBlockState(), (Integer) ExampleConfig.EXAMPLE_ORE_SIZE.get(), (Integer) ExampleConfig.EXAMPLE_ORE_MIN_HEIGHT.get(), (Integer) ExampleConfig.EXAMPLE_ORE_MAX_HEIGHT.get(), (Integer) ExampleConfig.EXAMPLE_ORE_AMOUNT.get()); } } private static void exampleOreGenerate(BiomeGenerationSettingsBuilder settings, RuleTest fillerType, BlockState state, int veinSize, int minHeight, int maxHeight, int amount) { settings.addFeature(Decoration.UNDERGROUND_ORES, (ConfiguredFeature)((ConfiguredFeature)((ConfiguredFeature) Feature.ORE.configured(new OreConfiguration(fillerType, state, veinSize)).rangeUniform(VerticalAnchor.aboveBottom(minHeight), VerticalAnchor.belowTop(maxHeight))).squared()).count(amount)); } } The configuration: public class ExampleConfig { public static final Builder BUILDER = new Builder(); public static final ForgeConfigSpec SPEC; public static final ConfigValue<Boolean> EXAMPLE_ORE_GENERATION; public static final ConfigValue<Integer> EXAMPLE_ORE_SIZE; public static final ConfigValue<Integer> EXAMPLE_ORE_MIN_HEIGHT; public static final ConfigValue<Integer> EXAMPLE_ORE_MAX_HEIGHT; public static final ConfigValue<Integer> EXAMPLE_ORE_AMOUNT; public ExampleConfig() { } static { BUILDER.push("Example ore generation"); EXAMPLE_ORE_GENERATION = BUILDER.define("Generate example ore", true); EXAMPLE_ORE_SIZE = BUILDER.define("Example ore vein size", 8); EXAMPLE_ORE_MIN_HEIGHT = BUILDER.define("Minimum example ore generation height", 16); EXAMPLE_ORE_MAX_HEIGHT = BUILDER.define("Maximum example ore generation height", 32); EXAMPLE_ORE_AMOUNT = BUILDER.define("Amount of generate example ore", 31); <- This is the value BUILDER.pop(); SPEC = BUILDER.build(); } } It seems that the problem is in the "amount" parameter, since if I change it, it will not The mineral is generated, or it is generated as it should not, if I set it to a value of 16 or less, the mineral is not generated, but if I set it to a value of 17 or greater, it is generated ignoring the maximum and minimum height established.
  3. I am making a block which I want to emit lighting, but I don't understand how it really works, all it says is that it needs .lightLevel(ToIntFunction<BlockState> p_60954_) but I don't understand what parameter to put in the missing, it may seem silly, but it would help me a lot if you explained.
  4. I see, I assure you that this answer is much better than the previous one, I have been used to adding those parameters in the properties of the block for two years, so it did not occur to me, thank you very much for the answers.
  5. I know that with the new updates those same parameters were changed, since I tried to solve my problem by reading the changelog, but no option that resembles it appears, they seem totally eliminated.
  6. public class ModBlocks { public static final DeferredRegister<Block> BLOCKS; public static final RegistryObjet<Block> KYPTOITE_ORE; public ModBlocks{} static { BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, "gworld"); KYPTOITE_ORE = BLOCKS.register("kyptoite_ore", () -> { return new KyptoiteOre(Properties.of(Material.STONE).destroyTime(5).explosionResistance(1000) .sound(SoundType.STONE).requieresCorrectToolForDrops()); }); } } Normally there would be the options of "harvestTool" and "harvestLevel", since I plan to add a great variety of ores, I mean, peaks for better minerals than diamond and I want to add for example "harvestLevel" at level 5, before they were, I was developing the mod on 37.0.26, but that version had a bug with the "loot_tables", so I opted to update my project and now I'm stuck for that. (The project is in forge 37.0.33)
  7. Could you show us an example? I also have the same doubt and the truth is I can't find a way to solve it, besides the other thread doesn't give me ideas about anything either.
×
×
  • Create New...

Important Information

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