VivecraftMod icon indicating copy to clipboard operation
VivecraftMod copied to clipboard

mod dev compatibility/dependency feature request

Open westbot657 opened this issue 1 year ago • 10 comments

I'm not actually sure what to describe this request as, but I've started working on a mod and I've hit a problem where a lot of vivecraft's custom rendering code is within Mixin classes, which means as a mod dev using vivecraft as a dependency, I cannot directly mixin to any of the modified rendering code of vivecraft without the use of MixinSquared, which discourages using itself for projects that are openly maintained

westbot657 avatar Jan 05 '25 11:01 westbot657

which part exactly do you need to modify?

fayer3 avatar Jan 05 '25 11:01 fayer3

the ItemInHandRendererVRMixin is the one I'm focused on right now

westbot657 avatar Jan 05 '25 11:01 westbot657

hm, we could extract that yeah

fayer3 avatar Jan 05 '25 11:01 fayer3

ok, thank you, that would be very helpful! thanks for the quick responding!

westbot657 avatar Jan 05 '25 11:01 westbot657

hm, looking a bit closer at it I can't just move it out. what exactly do you want to do with it?

fayer3 avatar Jan 05 '25 13:01 fayer3

I would like to be able to disable the rendering of a specific item so that I can render it a bit differently in a way where I need to be able to use info (world-space positions/player entity positions/hand positions) that is available in the held item render code, but that the item rendering code isn't told about.

I think looking at the mixin, I'm assuming the difficult part about extracting the methods is "this"? you would probably just make it a parameter for the extracted methods and refer to it as "instance" or something in the new code? I could try making a pull request to change it if that's ok?

westbot657 avatar Jan 05 '25 14:01 westbot657

is ther any reason why you can't just mixin into VivecraftItemRendering.applyThirdPersonItemTransforms / VivecraftItemRendering.applyFirstPersonItemTransforms?

fayer3 avatar Jan 05 '25 18:01 fayer3

But if that is something more people would want to do, we can add something to override positions per item to the upcomming API

fayer3 avatar Jan 05 '25 18:01 fayer3

is ther any reason why you can't just mixin into VivecraftItemRendering.applyThirdPersonItemTransforms / VivecraftItemRendering.applyFirstPersonItemTransforms?

actually, this might work for me, thanks! though it's probably still worth having a way to override what renders, I happen to want to just render the item model with different transforms, but I could see other people wanting to render a different model (or models) entirely

westbot657 avatar Jan 05 '25 21:01 westbot657

After some discussion in Discord, the thought is to reasonably maximize the amount of options mod devs have.

  • For static transforms, the hope is to add a value to ItemDisplayContext, so mod developers can specify the VR-specific transforms as they do others.
  • For more dynamic transformations, we'd add to the API (depends on #255). There would be several interfaces that allow for both replacing individual item's rendering and the rendering of any item as a whole. Each of those would support either just replacing the transform or taking over rendering entirely.
    • For example, the "rendering of any item + taking over rendering" could have a method signature of something like @Nullable ItemStack customItemInHandRender(PoseStack poseStack, ItemStack inputItem). Returning an ItemStack would move onto the next renderer or just directly to Vivecraft to render that ItemStack (whether it was the same or different as the input one) while null would stop further renderers. The body of the method would be used to both determine whether to overwrite and just any custom rendering logic.

hammy275 avatar Feb 06 '25 01:02 hammy275