Cerandior Posted August 15, 2019 Share Posted August 15, 2019 I was working on a custom monster. I wanted it to spawn on any light level, but below Y=40. So I don't want it to spawn naturally on the surface. I looked on some methods on my entity class and I came upon the *canSpawn* method, and I thought that would do the trick, but it is not working. Perhaps I am using it wrong? I also have another problem where my entity has random "spasms" and it goes crazy spinning around fast even though the movement speed is not set that high. It is also completely ignoring me even though I believe, according to the goals I have set for it, it should attack players when it sees one. The last issue that I have has to do with adding my entity to the spawn list of all the biomes. I want it to spawn pretty much everywhere except for the ocean biomes. I tried doing something, but it doesn't seem that efficient because I have to type out all the biomes myself. Perhaps there is a better way to do this, but I cannot think of something else. Any help would be appreciated. Thank you for your time. The problem with the spinning: My EntityRegistry Class: https://gist.github.com/Cerandior/60b1ac925525f7b5374af9d45e2ee3bf My Entity Class: https://gist.github.com/Cerandior/71230de0484594007d24cf52dd694e2e Quote Link to comment Share on other sites More sharing options...
Cerandior Posted August 16, 2019 Author Share Posted August 16, 2019 I tried using the onInitialSpawn method and killed the entity if it is spawned on a higher level from Y=40, but that hardly looks like a permanent solution. I am sure canSpawn should be able to do something here, but I believe I am not using it right. What exactly is "SpawnReason"? Perhaps I can use that to achieve what I want. Quote Link to comment Share on other sites More sharing options...
Animefan8888 Posted August 16, 2019 Share Posted August 16, 2019 1 hour ago, Cerandior said: I tried using the onInitialSpawn method and killed the entity if it is spawned on a higher level from Y=40, but that hardly looks like a permanent solution. I am sure canSpawn should be able to do something here, but I believe I am not using it right. What exactly is "SpawnReason"? Perhaps I can use that to achieve what I want. A speed of 1.0 is way too high. It means 1 block per tick. To put that into retrospect the Zombie only has a base speed of ~.23. It also seems that canSpawn is called to late in the spawning process and will only deny spawning if the entity is far away from the player. In forge version 1.14.4-28.0.21 if seems impossible to do custom spawning mechanics besides using the LivingSpawnEvent.CheckSpawn event to deny the spawning. Quote VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator. Link to comment Share on other sites More sharing options...
Cerandior Posted August 16, 2019 Author Share Posted August 16, 2019 (edited) 15 minutes ago, Animefan8888 said: A speed of 1.0 is way too high. It means 1 block per tick. To put that into retrospect the Zombie only has a base speed of ~.23. It also seems that canSpawn is called to late in the spawning process and will only deny spawning if the entity is far away from the player. In forge version 1.14.4-28.0.21 if seems impossible to do custom spawning mechanics besides using the LivingSpawnEvent.CheckSpawn event to deny the spawning. Thank you for your answer. It seems I had underestimated the value I had set to the "speed" variable, I tried something smaller and the entity is behaving correctly. About the second point. This may pose a problem to me for another thing. I was intending to create a new boss which would spawn when the player entered a certain structure. You said that it seems impossible to do custom spawning mechanics at the moment. Is that true only for "natural' world spawns, or includes this scenario as well? On an unrelated note. I was trying to create some custom Dispenser Behaviours for some certain items and I am not quite sure where I am supposed to register my Behaviours. I registered them under the FMLClientSetupEvent, but I am not sure if it is the right place to do this. It caused no problems when I tested it, but maybe it's in the wrong spot in the hierarchy of registrations and may cause problems with other mods. Edited August 16, 2019 by Cerandior Quote Link to comment Share on other sites More sharing options...
Animefan8888 Posted August 16, 2019 Share Posted August 16, 2019 1 minute ago, Cerandior said: I registered them under the FMLClientSetupEvent, You've probably gotta use the CommonSetupEvent for this the server needs to know as well. 1 minute ago, Cerandior said: You said that it seems impossible to do custom spawning mechanics at the moment. Is that true only for "natural' world spawns, or includes this scenario as well? As long as you don't register the boss to spawn naturally then spawning it only when the player enters the structure should work no problems. It's just the Slime spawning mechanics(certain heights etc) are controlled by a custom function registered to a Map that is private in EntitySpawnPlacementRegistry.class. At least I couldn't find a way to register your own placement type for an entity. 1 Quote VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator. Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.