-
Posts
116 -
Joined
-
Last visited
Converted
-
Gender
Undisclosed
-
Personal Text
I am new!
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
salvestrom's Achievements
Creeper Killer (4/8)
10
Reputation
-
1.15 custom surface builder issue [Solved]
salvestrom replied to salvestrom's topic in Modder Support
I now have this setup as below. This allowed 2 to 3 dozen chunks to spawn. I was able to get rest to work smoothly by removing my custom mobs from the spawn list in the biome class. I don't think their placement code is in place properly. I assumed this was the problem along. This is the registration class for the surface builder. @EventBusSubscriber(modid = References.MODID, bus = EventBusSubscriber.Bus.MOD) @ObjectHolder(References.MODID) public class RegisterSurfaceBuilders { @ObjectHolder(References.MODID + ":jungle_mountain_builder") public static SurfaceBuilder<SurfaceBuilderConfig> JUNGLE_MOUNTAIN=new JungleMountainSurfaceBuilder(); @SubscribeEvent public static void registerSurfaceBuilders(final RegistryEvent.Register<SurfaceBuilder<?>> event) { registerBuilder(event.getRegistry(), JUNGLE_MOUNTAIN, "jungle_mountain_builder"); } private static <T extends SurfaceBuilder<?>> T registerBuilder(final IForgeRegistry<SurfaceBuilder<?>> registry, final T builder, final String builderName) { if(registry==null) { throw new NullPointerException("Something's gone wrong!"); } else { builder.setRegistryName(References.MODID, builderName); registry.register(builder); } return builder; } } And this is the surface builder class. public class JungleMountainSurfaceBuilder extends SurfaceBuilder<SurfaceBuilderConfig> { public JungleMountainSurfaceBuilder() { super(SurfaceBuilderConfig::deserialize); } public void buildSurface(Random random, IChunk chunkIn, Biome biomeIn, int x, int z, int startHeight, double noise, BlockState defaultBlock, BlockState defaultFluid, int seaLevel, long seed, SurfaceBuilderConfig config) { if (noise > 3.0D) { SurfaceBuilder.DEFAULT.buildSurface(random, chunkIn, biomeIn, x, z, startHeight, noise, defaultBlock, defaultFluid, seaLevel, seed, SurfaceBuilder.STONE_STONE_GRAVEL_CONFIG); } else { SurfaceBuilder.DEFAULT.buildSurface(random, chunkIn, biomeIn, x, z, startHeight, noise, defaultBlock, defaultFluid, seaLevel, seed, SurfaceBuilder.GRASS_DIRT_GRAVEL_CONFIG); } } } -
The moment the game tries to load the biome that the surface builder is associated there is a crash. The issue only occurs when using my custom surface builder. Using the vanilla mountain surface builder, there is no issue. Registration seems to be checking out – the builder isn't returning null. Below is a crash log of the error.It seems to come down to setSeed, but there is no indication I need to specifically supply the seed in the surface builder. Most of the vanilla ones don't – the mountain surface builder amongst them. This is the registration class for the surface builder. @EventBusSubscriber(modid = References.MODID, bus = EventBusSubscriber.Bus.MOD) @ObjectHolder(References.MODID) public class RegisterSurfaceBuilders { @ObjectHolder(References.MODID + ":jungle_mountain_builder") public static SurfaceBuilder<SurfaceBuilderConfig> JUNGLE_MOUNTAIN; @SubscribeEvent public static void registerSurfaceBuilders(final RegistryEvent.Register<SurfaceBuilder<?>> event) { JUNGLE_MOUNTAIN = new JungleMountainSurfaceBuilder(SurfaceBuilderConfig::deserialize); registerBuilder(event.getRegistry(), JUNGLE_MOUNTAIN, "jungle_mountain_builder"); } private static <T extends SurfaceBuilder<?>> T registerBuilder(final IForgeRegistry<SurfaceBuilder<?>> registry, final T builder, final String builderName) { if(registry==null) { throw new NullPointerException("Something's gone wrong!"); } else { builder.setRegistryName(References.MODID, builderName); registry.register(builder); } return builder; } } And this is the surface builder class. public class JungleMountainSurfaceBuilder extends SurfaceBuilder<SurfaceBuilderConfig> { public JungleMountainSurfaceBuilder(Function<Dynamic<?>, ? extends SurfaceBuilderConfig> p_i51310_1_) { super(p_i51310_1_); } public void buildSurface(Random random, IChunk chunkIn, Biome biomeIn, int x, int z, int startHeight, double noise, BlockState defaultBlock, BlockState defaultFluid, int seaLevel, long seed, SurfaceBuilderConfig config) { if (noise > 3.0D) { SurfaceBuilder.DEFAULT.buildSurface(random, chunkIn, biomeIn, x, z, startHeight, noise, defaultBlock, defaultFluid, seaLevel, seed, SurfaceBuilder.STONE_STONE_GRAVEL_CONFIG); } else { SurfaceBuilder.DEFAULT.buildSurface(random, chunkIn, biomeIn, x, z, startHeight, noise, defaultBlock, defaultFluid, seaLevel, seed, SurfaceBuilder.GRASS_DIRT_GRAVEL_CONFIG); } } }
-
I did not say at any point that your model should extend model entity. This requires three classes. Your entity class should extend HorseEntity giving you access to all of the GUI, saddling and taming. Your render class should be adjusted to not be using the superfluous classy created, as I previously mentioned. Your model class needs to extend HorseModel – this is how you will inherit the animations and bulk of the model. Note that AbstractHorseEntity does not have all of the code for horses, only the shared code between the various horse entities.
-
I have been unable to resolve this. Does anyone have any input?
-
The moment the game tries to load the biome that the surface builder is associated there is a crash. The issue only occurs when using my custom surface builder. Using the vanilla mountain surface builder, there is no issue. Registration seems to be checking out – the builder isn't returning null. Below is a crash log of the error.It seems to come down to setSeed, but there is no indication I need to specifically supply the seed in the surface builder. Most of the vanilla ones don't – the mountain surface builder amongst them – unless they are making specific changes. This is the registration class for the surface builder. @EventBusSubscriber(modid = References.MODID, bus = EventBusSubscriber.Bus.MOD) @ObjectHolder(References.MODID) public class RegisterSurfaceBuilders { @ObjectHolder(References.MODID + ":jungle_mountain_builder") public static SurfaceBuilder<SurfaceBuilderConfig> JUNGLE_MOUNTAIN; @SubscribeEvent public static void registerSurfaceBuilders(final RegistryEvent.Register<SurfaceBuilder<?>> event) { JUNGLE_MOUNTAIN = new JungleMountainSurfaceBuilder(SurfaceBuilderConfig::deserialize); //final IForgeRegistry<SurfaceBuilder<?>> registry = //System.out.println(JUNGLE_MOUNTAIN); event.getRegistry().registerAll( JUNGLE_MOUNTAIN.setRegistryName("jungle_mountain_builder") //registry.register();registerBuilder(event.getRegistry(), JUNGLE_MOUNTAIN, "jungle_mountain_builder") ); } private static <T extends SurfaceBuilder<?>> T registerBuilder(final IForgeRegistry<SurfaceBuilder<?>> registry, final T builder, final String builderName) { if(registry==null) { throw new NullPointerException("Something's gone wrong!"); } else { builder.setRegistryName(References.MODID, builderName); //registry.register(builder); } return builder; } } And this is the surface builder class. public class JungleMountainSurfaceBuilder extends SurfaceBuilder<SurfaceBuilderConfig> { public JungleMountainSurfaceBuilder(Function<Dynamic<?>, ? extends SurfaceBuilderConfig> p_i51310_1_) { super(p_i51310_1_); } public void buildSurface(Random random, IChunk chunkIn, Biome biomeIn, int x, int z, int startHeight, double noise, BlockState defaultBlock, BlockState defaultFluid, int seaLevel, long seed, SurfaceBuilderConfig config) { if (noise > 3.0D) { SurfaceBuilder.DEFAULT.buildSurface(random, chunkIn, biomeIn, x, z, startHeight, noise, defaultBlock, defaultFluid, seaLevel, seed, SurfaceBuilder.STONE_STONE_GRAVEL_CONFIG); } else { SurfaceBuilder.DEFAULT.buildSurface(random, chunkIn, biomeIn, x, z, startHeight, noise, defaultBlock, defaultFluid, seaLevel, seed, SurfaceBuilder.GRASS_DIRT_GRAVEL_CONFIG); } } }
-
First: In 1.12 there was a hook in GenLayer for the WorldTypeEvent.initBiomeGen. In 1.14 the event still exists, but the hook is absent. I would request an alternative/additional hook, however, in the IForgeWorldType/WorldType class.So that mods can do exactly what the AddBambooForestLayer is doing – replacing an entire biome within a larger biome region in one go. default <T extends IArea, C extends IExtendedNoiseRandom<T>> IAreaFactory<T> getBiomeLayer(IAreaFactory<T> parentLayer, OverworldGenSettings chunkSettings, LongFunction<C> contextFactory) { parentLayer = (new BiomeLayer(getWorldType(), chunkSettings)).apply(contextFactory.apply(200L), parentLayer); parentLayer = AddBambooForestLayer.INSTANCE.apply(contextFactory.apply(1001L), parentLayer); parentLayer = LayerUtil.repeat(1000L, ZoomLayer.NORMAL, parentLayer, 2, contextFactory); parentLayer = EdgeBiomeLayer.INSTANCE.apply(contextFactory.apply(1000L), parentLayer); return parentLayer; } By the time you get to the world type event the biome map has been zoomed and smoothed and the coordinates represent a single chunk, rather than the entire biome. The event requires the use of some sort of noise that will randomly replace part of the biome and the results are not ideal. It also seems that terrain variation has already been handled. Swapping a mountain for a swamp at this point will give you a mountainous swamp, for example.
-
Ever since I started this mod in 1.7 I have had an optional world type that enabled me to have my jungle biomes spawn within the boundaries of existing jungles. Although it doesn't really affect the mod to not use the world type many people have expressed the desire to have access to the biomes in conjunction with using mods such as biomes o plenty. Recently, I was directed to the mod Buildcraft (1.12) who have their code on github. The link below takes you to the folder where most of the magic occurs. I reproduced this code with only name changes for making sense of it amongst my own mod. BuildCraft I've fiddled with the noise scale and threshold number to increase the biome size and frequency, but the result was not desirable. I think the problem is that the world type event is called after magnification of the biome map so that each passed in coordinate represents a single chunk on the map, instead of a full biome as it does during my current world type code, partially reproduced here: I originally cut out the Buildcraft noise generation check in favour of reproducing the jungle section of the JungleGenLayer I had created. This is where I discovered the issue that the random check is applied for every single X, Z coordinate within a chunk leading to a patchwork of biomes one block in size. Edit: I also wanted to note that using the Buildcraft code doesn't seem to affect the actual terrain/landscape. My mountain biome will be flat and my swamp biome will be hilly. None of the values from my biome classes appear to get applied. 1.14 I'm in the middle of updating from 1.12 to 1.14 and thought I would check back to see what had changed with the above. Although the world type event class still exists the hook for it is no longer in the code, so as of now – even if the above were working – I wouldn't be able to use it. The ideal solution would seem to be a hook that occurs before any zooming. Anyone got any other suggestions?