Jump to content

kiou.23

Members
  • Posts

    444
  • Joined

  • Last visited

  • Days Won

    5

Everything posted by kiou.23

  1. you need to register a BlockItem for the block, and set it's group to be the Brewing ItemGroup
  2. BlockStates are all precalculated, and you have too many possible block states https://mcforge.readthedocs.io/en/1.15.x/blocks/states/#proper-usage-of-block-states you may want to consider another way to hold that data, a tile entity for example
  3. This seems to be a little above my level (and by a little I mean a lot). I had given up on trying to understand what was going on and was just copy-pasting code, and now I've giving up on that too. Waiting until Forge implements their solution to facilitate this seems like the better option for me at least thanks anyhow
  4. what comes to mind is that you could extend BlockItem, to make a KettleBlockItem, which places a block with a given blockstate, which you can set when creating a new instance of it in registration... look like the more elegant way of doing it, but I'm really not sure (and after looking at the BlockItem class for a few seconds trying to see wht you could override, I imagine it'd give a headache) and you could change what item the block drops based on blockstate as well
  5. getList() is never getting called. And shouldn't be adding the values to the hashSet in getter. add the values inside the block constructor, and in the getter just return your canMix
  6. the method hasTileEntity, and createTileEntity, take the current blockstate as a parameter, so you can decide wether or not your block has a tile entity based on the blockstate. that solves this problem blockstates do seem like the easier way to do what you want...
  7. correct, 1.16.4 mods are compatible with 1.16.5, you just need to add to the version range in mods.toml Yes, the vanilla and the forge code were entirely different, for 1.15 it would be easier (you'd still need a new repo), but for 1.12 you would be better off rewriting everything from scracth note that: the forum currently only supports 1.15 and 1.16, don't bother asking for help with other versions I believe this topic belongs under Modder Support, not Forge Gradle
  8. @fa1997123456789@gmail.com the mods.toml is under main/resources/META-INF also, please keep the forum in english
  9. make a new thread then, explaining what is it that you're trying to do and where you need help
  10. Okay, I took a look at the repository and the classes, I tried to specify it to my needs (which should be very simplistic), and ended up with the following code, is this how I should be doing this? Biome Provider: public class EffeteBiomeProvider extends BiomeProvider { public static final Codec<EffeteBiomeProvider> EFFETE_CODEC = RecordCodecBuilder.create(builder -> builder.group( RegistryLookupCodec.getLookUpCodec(Registry.BIOME_KEY).forGetter(provider -> provider.lookupRegistry), Codec.LONG.fieldOf("seed").stable().forGetter(provider -> provider.seed) ).apply(builder, builder.stable(EffeteBiomeProvider::new)) ); private final Registry<Biome> lookupRegistry; private final long seed; public EffeteBiomeProvider(Registry<Biome> lookupRegistry, long seed) { super(getBiomes(lookupRegistry)); this.lookupRegistry = lookupRegistry; this.seed = seed; } private static List<Biome> getBiomes(Registry<Biome> biomeRegistry) { return biomeRegistry.stream() .filter(biome -> biome.getCategory() == Biome.Category.NETHER) .collect(Collectors.toList()); } @Override public Biome getNoiseBiome(int x, int y, int z) { return ModBiomes.EFFETE_FOREST.get(); } @Override protected Codec<? extends BiomeProvider> getBiomeProviderCodec() { return EFFETE_CODEC; } @Override public BiomeProvider getBiomeProvider(long seed) { return new EffeteBiomeProvider(lookupRegistry, seed); } public static void register() { Registry.register(Registry.BIOME_PROVIDER_CODEC, "effete_biome_provider", EFFETE_CODEC); } } DimensionTypeMixin: @Mixin(DimensionType.class) public class DimensionTypeMixin { @Inject(at = @At("HEAD"), method = "getNetherChunkGenerator(Lnet/minecraft/util/registry/Registry;Lnet/minecraft/util/registry/Registry;J)Lnet/minecraft/world/gen/ChunkGenerator;", cancellable = true) private static void effeteGenerator(Registry<Biome> registry, Registry<DimensionSettings> settings, long seed, CallbackInfoReturnable<ChunkGenerator> info) { info.setReturnValue(new NoiseChunkGenerator( new EffeteBiomeProvider(registry, seed), seed, () -> settings.getOrThrow(DimensionSettings.field_242736_e) )); } } some follow up question too: does this makes my biome spawn in the nether, and nether alone? and would this conflict with other mods that add nether biomes?
  11. kiou.23

    Guide

    you have the javadocs, which are comments written in the code which describe how that piece of code works. but even, you can just read the code itself, and walk through it, to get an understanding of how to do it for instance: if you want to make a new tile entity, you could look at the code of vanilla tile entities, such as the furnace, to get a grasp of what the code looks like, what classes to extend, what interfaces to use, what methods to override or call, all that...
  12. kiou.23

    Guide

    your documentation? what do you mean? for a guide look no further than the vanilla code itself. anything that you should do differently than how vanilla does it should be in the forge docs, and if yet you face some more specific problems, you can come to the forums or go to the discord for help
  13. by this topic I assume you're new to programming, what I can tell you is to dedicate some hours to go learn programming logic, and then Object Oriented Programming. you can't expect to find copy and paste solutions for everything you may want to do. but in case you already know programming: any tool is just a subclass of Item, you just need to register your own instances of it as you'd do with any item. (that's for custom shovels, axes, pickaxes... if you want to create a new tool type, then you'd have to implement your own custom logic and tool type for it (which I don't know how to do, but shouldn't be hard to figure out))
  14. I have a custom biome, and I want to add custom features to it. however, using ".withFeature()", in the biome generation settings isn't working, because the biome gets initialized before the features does, giving me a Null Pointer Exception Biome (gets initialized through a deferred register): @Mod.EventBusSubscriber(modid = Main.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD) public class ModBiomes { public static final DeferredRegister<Biome> BIOMES = DeferredRegister.create(ForgeRegistries.BIOMES, Main.MOD_ID); public static final RegistryObject<Biome> EFFETE_FOREST = BIOMES.register("effete_forest", Maker::EffeteForest); @SubscribeEvent public static void setupBiomes(FMLCommonSetupEvent event) { event.enqueueWork(() -> setupBiome(EFFETE_FOREST.get(), BiomeManager.BiomeType.WARM, 10000000, //1000 Type.NETHER, Type.FOREST, Type.HOT, Type.DRY) ); } private static void setupBiome(Biome biome, BiomeManager.BiomeType type, int weight, Type... types) { RegistryKey<Biome> key = RegistryKey.getOrCreateKey( ForgeRegistries.Keys.BIOMES, Objects.requireNonNull(ForgeRegistries.BIOMES.getKey(biome), "Biome registry name was null") ); BiomeDictionary.addTypes(key, types); BiomeManager.addBiome(type, new BiomeManager.BiomeEntry(key, weight)); } private static class Maker { private static Biome EffeteForest() { BiomeGenerationSettings genset = new BiomeGenerationSettings.Builder() .withFeature(GenerationStage.Decoration.VEGETAL_DECORATION, ModFeatures.EFFETE_STEM_CONFIG) // Above line gives a null pointer exception since EFFETE_STEM_CONFIG hasn't been initialized yet .withFeature(GenerationStage.Decoration.VEGETAL_DECORATION, Features.RED_MUSHROOM_NETHER) .withFeature(GenerationStage.Decoration.VEGETAL_DECORATION, Features.NETHER_SPROUTS) .withFeature(GenerationStage.Decoration.UNDERGROUND_ORES, Features.ORE_GOLD_NETHER) .withFeature(GenerationStage.Decoration.UNDERGROUND_ORES, Features.ORE_QUARTZ_NETHER) .withStructure(StructureFeatures.BASTION_REMNANT) .withStructure(StructureFeatures.NETHER_FOSSIL) .withStructure(StructureFeatures.RUINED_PORTAL_NETHER) .withSurfaceBuilder(ModConfiguredSurfaceBuilders.EFFETE_SURFACE_BUILDER) .build(); MobSpawnInfo mobspawn = new MobSpawnInfo.Builder() .withSpawner(EntityClassification.MONSTER, new MobSpawnInfo.Spawners(EntityType.CAT, 4, 2, 4)) .copy(); BiomeAmbience ambience = new BiomeAmbience.Builder() .withGrassColor(0xDA67C1) .setFogColor(0xEEEEEE) .setWaterColor(0xCF21B8) .setWaterFogColor(0xCF78C5) .withSkyColor(0xE83452) .withFoliageColor(0xCA57C1) .build(); return new Biome.Builder() .category(Biome.Category.NETHER) .withTemperatureModifier(Biome.TemperatureModifier.NONE) .withGenerationSettings(genset) .withMobSpawnSettings(mobspawn) .depth(0.09f) .scale(0.2f) .downfall(0.1f) .precipitation(Biome.RainType.NONE) .temperature(1.1f) .setEffects(ambience) .build(); } } } Feature (gets initialized in Common setup): @Mod.EventBusSubscriber(modid = Main.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD) public class ModFeatures { public static ConfiguredFeature<?, ?> EFFETE_STEM_CONFIG; @SubscribeEvent public static void setup(FMLCommonSetupEvent e) { EFFETE_STEM_CONFIG = register("effete_stem_feature", Feature.RANDOM_PATCH .withConfiguration( (new BlockClusterFeatureConfig.Builder( new SimpleBlockStateProvider(ModBlocks.EFFETE_STEM.get().getDefaultState()), new EffeteColumnBlockPlacer(1, 2) )).tries(3).ySpread(0).func_227317_b_().build() ).withPlacement( Placement.COUNT_MULTILAYER.configure(new FeatureSpreadConfig(5)).square() ) ); } private static <FC extends IFeatureConfig> ConfiguredFeature<FC, ?> register(String key, ConfiguredFeature<FC, ?> configuredFeature) { return Registry.register(WorldGenRegistries.CONFIGURED_FEATURE, key, configuredFeature); } }
  15. I have a custom biome I'm adding into the game, however, I want it to spawn in the Nether only. currently the biome only spawns in the overworld, and does not spawn in the nether. Biome Registration: @Mod.EventBusSubscriber(modid = Main.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD) public class ModBiomes { public static final DeferredRegister<Biome> BIOMES = DeferredRegister.create(ForgeRegistries.BIOMES, Main.MOD_ID); public static final RegistryObject<Biome> EFFETE_FOREST = BIOMES.register("effete_forest", Maker::EffeteForest); @SubscribeEvent public static void setupBiomes(FMLCommonSetupEvent event) { event.enqueueWork(() -> setupBiome(EFFETE_FOREST.get(), BiomeManager.BiomeType.WARM, 10000000, //1000 Type.NETHER, Type.FOREST, Type.HOT, Type.DRY) ); } private static void setupBiome(Biome biome, BiomeManager.BiomeType type, int weight, Type... types) { RegistryKey<Biome> key = RegistryKey.getOrCreateKey( ForgeRegistries.Keys.BIOMES, Objects.requireNonNull(ForgeRegistries.BIOMES.getKey(biome), "Biome registry name was null") ); BiomeDictionary.addTypes(key, types); BiomeManager.addBiome(type, new BiomeManager.BiomeEntry(key, weight)); } private static class Maker { private static Biome EffeteForest() { BiomeGenerationSettings genset = new BiomeGenerationSettings.Builder() .withFeature(GenerationStage.Decoration.VEGETAL_DECORATION, Features.RED_MUSHROOM_NETHER) .withFeature(GenerationStage.Decoration.VEGETAL_DECORATION, Features.NETHER_SPROUTS) .withFeature(GenerationStage.Decoration.UNDERGROUND_ORES, Features.ORE_GOLD_NETHER) .withFeature(GenerationStage.Decoration.UNDERGROUND_ORES, Features.ORE_QUARTZ_NETHER) .withStructure(StructureFeatures.BASTION_REMNANT) .withStructure(StructureFeatures.NETHER_FOSSIL) .withStructure(StructureFeatures.RUINED_PORTAL_NETHER) .withSurfaceBuilder(ModConfiguredSurfaceBuilders.EFFETE_SURFACE_BUILDER) .build(); MobSpawnInfo mobspawn = new MobSpawnInfo.Builder() .withSpawner(EntityClassification.MONSTER, new MobSpawnInfo.Spawners(EntityType.CAT, 4, 2, 4)) .copy(); BiomeAmbience ambience = new BiomeAmbience.Builder() .withGrassColor(0xDA67C1) .setFogColor(0xEEEEEE) .setWaterColor(0xCF21B8) .setWaterFogColor(0xCF78C5) .withSkyColor(0xE83452) .withFoliageColor(0xCA57C1) .build(); return new Biome.Builder() .category(Biome.Category.NETHER) .withTemperatureModifier(Biome.TemperatureModifier.NONE) .withGenerationSettings(genset) .withMobSpawnSettings(mobspawn) .depth(0.09f) .scale(0.2f) .downfall(0.1f) .precipitation(Biome.RainType.NONE) .temperature(1.1f) .setEffects(ambience) .build(); } } }
  16. https://mcforge.readthedocs.io/en/latest/events/intro/ you shouldn't be putting event handlers in Item classes, but in specific event handler classes (separation of concern). your event handlers then should be registered to the Event Bus, so that the event listeners actually fire. The linked doc page explains it further
  17. Look, when I decided to get into modding C# was the only language I knew. I saw forge and minecraft, were programmed in Java, but I didn't want to learn Java because I loved C#. I looked everywhere for ways to do it and couldn't find none. it's a non-sensical task: you'd need to write wrappers for all the classes that minecraft and forge provides, and then you would need to keep updating it everytime a new mapping or forge/minecraft version came out. it's a lot of work, for very little benefit, the modding communnity isn't big enough for this to be a reasonable project. you could look into how to write c# that compiles to jar's, sure.. but you still would need access to classes that exist in Java code. What I can tell you is that it is not worth it. We, programmers, can't fall in love for a language and try do to everything with it, it's a very common programming sin. You need to recognize the best language for the job, and accept it. And if you just ahte the language so much you can't even think of writing in it, then maybe not doing the project is just a better option The best I could recommend you, if you really don't want to write Java, is to take a look at Kotlin or Scala, they are better versions of Java basically. Or do what I did, learned Java, it isn't even that bad. but having to do C programming really lowered my bars and also, maybe think a little bit before saying a Forum Moderator that has been contributing to the modding community for 8+ years, doesn't know what he's talking about. you're the newbie here, tyring to do something that is, honestly, idiotic
  18. you need to run the runData task, not the runClient task, to execute the generators
  19. That's usually the case, always try to understand the code before copy and pasting, or else you'll get a lot of headaches later in the code's life
  20. in your own IDE you can search for the blocks. in IntelliJ you can use Ctrl + N, and type the name of the class you're looking for (RotatedPillarBlock, it's the class the logs use) in Eclipse I think it is Ctrl + Shift + T, but I'm not sure note that the vanilla and forge classes we'll be read-only, you can't edit them
  21. don't give people copy'n'paste code, especially without any explanation as to way they should copy and paste
  22. what do you mean? we don't have your registration code, so we can't tell
×
×
  • Create New...

Important Information

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