Code Monkey home page Code Monkey logo

Comments (10)

noobanidus avatar noobanidus commented on August 30, 2024 1

That's definitely a bug on Forge's part, then, because neither the function they call in the state nor the function that it calls in the block will accept a null entity type... I might go file a bug.

EDIT: Especially demonstrable by the fact that the Vanilla magma block is accessing the EntityType directly without testing for null first.

EDIT 2: I've filed a Forge issue for this: MinecraftForge/MinecraftForge#6326

from moreoverlays.

feldim2425 avatar feldim2425 commented on August 30, 2024

I can reproduce it without optifine. The problem seems to be something about getting the spawn information from magma blocks. Just turning on the overlay and placing a magmablock in rage of the overlay is enough to crash immediately.

from moreoverlays.

feldim2425 avatar feldim2425 commented on August 30, 2024

After a quick look into the source code for the magmablock it either seems that it's canEntitySpawn method was programmed without keeping in mind that the EntityType can be null or the method is documented wrong since they marked that parameter as Nullable.

The fix sadly reduces performance a bit since I have to check every singe monster entitytype that might spawn. So I added a config option to make a simple check just for the Zombie entity.

from moreoverlays.

noobanidus avatar noobanidus commented on August 30, 2024

That's interesting, I was just coming to report this and was checking through closed issues to see if it had already been discussed. It got brought up on our discord and there was some conversation about it.

I did have a look at the decompiled code from IntelliJ and interestingly enough it doesn't have a @Nullable notation on the EntityType parameter in either the BlockState implementation or the actual Block implementation. I'm not sure if my code has had it stripped out, however.

Of note, though, it seems that BlockMagma is one of the few that actually implement canEntitySpawn. I'm not sure whether that's helpful or not, though, as that can't really be used as a heuristic given modded blocks exist...

I personally would definitely recommend making the Zombie EntityType default, however, and adding an option for the "test every monster entitytype".

from moreoverlays.

feldim2425 avatar feldim2425 commented on August 30, 2024

Here is a link to the source: https://github.com/MinecraftForge/MinecraftForge/blob/6422310453fe4029a409adf19d3bac6bfb3ea589/src/main/java/net/minecraftforge/common/extensions/IForgeBlock.java#L269

IForgeBlock is implemented by Block because Forge uses a .patch file to add it. And I used that method to determine if mobs can spawn.

from moreoverlays.

wasche avatar wasche commented on August 30, 2024

Thanks for the super fast fix! Any idea what release this'll be in? Just curious, I've no problems building it for myself, but its nice to be lazy and just click the button in the launcher :)

I'd also second making zombie default and the option to check all.

from moreoverlays.

feldim2425 avatar feldim2425 commented on August 30, 2024

Already out in 1.16.1 alpha release on curseforge. Along with some other fixes and features.
https://www.curseforge.com/minecraft/mc-mods/more-overlays/files/2829171

EDIT: There it is still alpha since there are some more things planed for 1.14.4.

  • The config gui will get it's own list system since the vanilla AbstractList doesn't fit very well from the way it handles gui events, rendering and init-calls
  • I want to add some way to open the config ui ingame either by adding a button to the pause screen or via a client side command
  • The current system to detect mob spawns should get more options to set it into light only mode and maybe find a better way to detect mobspawns without checking all mobs.
  • I want to add IMC messages for the API.

from moreoverlays.

feldim2425 avatar feldim2425 commented on August 30, 2024

Also I should add that only checking for the EntityType "Zombie" has the problem, that blocks like the magma block won't show any overlay, since they only allow monsters that resist fire, thats why I currently set the default to check all mobs, because usually users will complain that the overlay doesn't work when they just had to change to the less performant setting.
I will try to add more options like a true ligt only mode and maybe I or someone else finds a better way to optimize the check (maybe caching the blocks spawn mode).

from moreoverlays.

noobanidus avatar noobanidus commented on August 30, 2024

Perhaps Zombie Pigman could be an alternative to zombie? I believe they should satisfy most conditions.

Additionally, a block(state?) -> boolean conditional map that could be cached might also help to simplify things, or at least speed up the process.

EDIT: Judging by the adjustment of tags to "1.14" and "cleanup", I'm going to presume that the "@Nullable" annotation remaining was an oversight from 1.12, where I presume it was accepting an Entity(Living?) instead of an EntityType.

from moreoverlays.

feldim2425 avatar feldim2425 commented on August 30, 2024

In 1.12 there was no extra parameter at least not in the method I used. It simply required the BlockState and the SpawnPlacementType. I don't know if spawns based on State, Placement and Entity were a thing in 1.12 but I assume "no".

from moreoverlays.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.