Cleanup damage source a bit#12106
Conversation
lynxplay
left a comment
There was a problem hiding this comment.
Generally I like the cleanup, passing the cause like this is a lot nicer.
The thing I am a bit confused on is the withers/setters in DamageSource now.
Some are withers, e.g. perform a copy, others actually mutate the instance.
It seems semi arbitrary, presumably this is fine like this as the setters are only called on instances copied prior, however that feels pretty much like we are asking for an explosion down the line given the inconsistent behaviour here.
The two setters, critial and customBlockState, are I think not in a hot enough code path where the one extra copy of a damage source (which involves 0 deep copying anyway) would be a problem.
Are there other reasons I missed as to why you decided to make them setters?
6d040ec to
f223e09
Compare
f223e09 to
78c075b
Compare
Closes #11025