-
Posts
116 -
Joined
-
Last visited
Everything posted by salvestrom
-
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?
-
Resolved. I took one last look at the code before closing my IDE and I finally found the reference to the scuffler class. It's completely erroneous and should be referencing its own class instead. Please delete this and spare me the shame. Anyone know what this is about? It doesn't seem to be causing any issues, and only seems to pop up once while roaming around a game world. The second class listed doesn't actually call the first class directly, but they do share a base class where some code is used to prevent them from damaging each other, but I turned it all off and still got the message. The scuffler entity does call the base class, but that code doesn't seem to be running when the message pops up. [m[33m[22:43:47] [Server thread/WARN] [minecraft/EntityDataManager]: defineId called for: class com.salvestrom.w2theJungle.mobs.entity.EntityLizardmanScuffler from class com.salvestrom.w2theJungle.mobs.entity.EntityLizardmanWitchDoctor
-
1.14.4 Block not dropping loot when material is set to WEB.
salvestrom replied to salvestrom's topic in Modder Support
Additional Breakpoint testing has revealed the issue is centred around this piece of code from the PlayerInteractionManager class. The flag and flag1 if statement is not being passed and so harvest block is not being run. boolean flag1 = blockstate.canHarvestBlock(this.world, pos, this.player); itemstack.onBlockDestroyed(this.world, blockstate, pos, this.player); if (itemstack.isEmpty() && !copy.isEmpty()) { net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this.player, copy, Hand.MAIN_HAND); } boolean flag = removeBlock(pos, flag1); if (flag && flag1) { ItemStack itemstack1 = itemstack.isEmpty() ? ItemStack.EMPTY : itemstack.copy(); block.harvestBlock(this.world, this.player, pos, blockstate, tileentity, itemstack1); } Remove block seemed pretty innocuous so I focused on canHarvestBlock. Looking into this led me to realise/discover that my climbing web, since it is using Material.WEB has a requires tool check and swords and shears are hardcoded for the Cobweb block. Quite how this is affecting things, I don't know, but when I changed the material to WOOD which has no tool requirement, the items began dropping correctly.If I want to continue using web as the material am I going to need to use the forge hook for canHarvestBlock? Or is there something else I'm missing… -
1.14.4 Block not dropping loot when material is set to WEB.
salvestrom replied to salvestrom's topic in Modder Support
Update/clarification: I set breakpoints on every single getDrops and spawnDrops method in block, as well as getLootTable and spawnAsEntity (simultaneously). I also overrode getLootTable in two of my block classes, using system counts to state that it had arrived at the code as well as display what the result of the super call is. The results were this: During model loading the breakpoints for getLootTable were triggered for every single block, including mine, including the climbing web. This method was triggered again on world load. I broke three blocks: dirt, a random one of mine and climbing web. The first two triggered multiple breakpoints in succession, the climbing web breaking triggered none of it. How can the game recognise the loot table while loading yet not even try to drop loot once in game? Again I note that my block extends the ladder, but the ladder itself contains nothing unusual. Besides, I have another ladder which doesn't have any issues. -
Edit: altered the title to more accurately reflect the problem. Please see four posts down almost up-to-date information. I set up all of the loot tables for my blocks and discovered one of them is not working. I have tried various versions of the file, Even the most simple table possible had noeffect. The version below is a direct copy paste from vanilla cobweb and hasn't even had the drops altered. I have used breakpoints on every single piece of code in the block class that references dropping blocks and none of them appear to be triggered. I have been able to verify that the block item is being registered (again, this is one amongst a dozen blocks all being registered in the same way). There are no errors/crashes in the console. Simply, nothing seems to drop. The block item registry name is set by calling the blocks registry name. There doesn't appear to be any other spelling issues. I have got to be missing something very simple. Also, the blocks class is an extension of the ladder class, comprised of an override for on entity collision which slows down any entities on the custom block and a redundant override of getitem() and getDrops() which was done to insert a system out (which produced nothing).
-
GlStateManager.pushMatrix(); GlStateManager.scale(0.75F, 0.75F, 0.75F); GlStateManager.translate(0, 16.0F * scale, 3 * scale); this.lowerbody.postRender(0.0625F); this.upperbody.postRender(0.0625F); this.neck.postRender(0.0625F); this.head1.render(scale); GlStateManager.popMatrix(); GlStateManager.pushMatrix(); GlStateManager.scalef(0.5F, 0.5F, 0.5F); GlStateManager.translatef(0.0F, 24.0F * scale, 0.0F); this.lowerbody.render(scale); GlStateManager.popMatrix(); The above was being done in the render method of the model class. Note that neck is a child of upperbody which is a child of lower body, but head1 is not a child of the neck. Although the head will move as the body rotates, this failed because the animations are scaled up with the size of the head, so the head will move in an exaggerated fashion due to things like breathing animations.
-
The damage multiplier is used directly on the fall distance, not the damage that you took from falling. Therefore, multiplying it by zero reduces your fall distance to 0. Which, I assume, is setting your Y motion to 0. Afraid I can't help with the space bar issue.
-
My own experience of this, attempting to create babies with enlarged heads for my custom entities, was that I could call poster render method to "connect" the head to the body without making it a child. It would move correctly as if a child model box, but the animation for the scaled box would also be scaled up so the head would animate in an exaggerated fashion compared to the rest of the body and therefore not be completely in sync. It occurred to me to try scaling the animation, but I never actually tried it.
-
I have been trying to rule out what it isn't, for example: the code for checking if an entity is being ridden is returning correctly. At the moment my focus is on trying to account for why the husk riding a horse won't move. A skeleton on a spider, spawned from a spider egg functions, but that's because it's not saddled and so it is the spider that is moving, not the rider. Which is another hint of where the problem may lie. Is there anyone reading this who has a functioning custom mount with a custom rider that is actually moving correctly so that I can be sure there is something wrong my end.
-
With what you're doing here, could you instead access the model file and insert an if statement to the animation method that checks for your item in hand and alters the angles there, before rendering?
-
Minecraft crashing and I have no idea whats gone wrong
salvestrom replied to moosyman's topic in Support & Bug Reports
The only mistake I've been able to spot is you are using "sarconite_ore_block" as the registry name for both the block and the ore.