-
Notifications
You must be signed in to change notification settings - Fork 192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix explosions being different from vanilla #98
Fix explosions being different from vanilla #98
Conversation
* @author 2No2Name | ||
*/ | ||
public class TypeCast { | ||
public static Explosion toExplosion(Object returnValue) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just inline this cast?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I usually get problems when trying to cast to the mixined class. Either intellij, mcdev or the compiler complains, or it crashes when applying the mixin
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
inconvertible types, because ExplosionMixin doesn't extend Explosion.
This can be circumvented by casting like this: (Explosion)(Object)this
But I had problems with that approach in the past, but I don't recall when exactly they occur.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is it cast to the Mixin in the first place? I thought you should cast it to an interface which the mixin implements?
Edit: nvm that wouldn't work for passing it as an argument, would it?
Can the mixin extend
the class it's mixing in to? I can't recall.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even then, I would have made it a private function in the mixin, instead of making a static class just for this.
src/main/java/me/jellysquid/mods/lithium/mixin/world/explosions/ExplosionMixin.java
Outdated
Show resolved
Hide resolved
|
||
// Get the explosion resistance like vanilla | ||
blastResistance = this.behavior.getBlastResistance((Explosion) (Object) this, this.world, pos, blockState, fluidState); | ||
break labelGetBlastResistance; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possibly cleaner to have this be a separate function to avoid the label and break
f162964
to
6260673
Compare
Vanilla changed how explosions work: Air blocks now have no effect on the blast rays, and each explosion has its own context that can adjust the explosion resistance of blocks or decide if a block can be destroyed at all (Respawn anchor and entities have their own special context)