NerdyPuzzle / MCreator-Nerdys_Geckolib_Plugin

MIT License
19 stars 9 forks source link

Feature Recommendations: Existing Entity Override & Model Change Procedures... #10

Open JadedChara opened 1 year ago

JadedChara commented 1 year ago

I've been dabbling with this plugin already, and one thing I've seen people requesting is an update to the Kleiders plugin. The ability to override existing entities, including players, as well as modify what's rendering, is something that'd be useful, particularly for RPG mods.

NerdyPuzzle commented 1 year ago

This is something I plan to experiment with, but it is in no way something I can promise will happen.

JadedChara commented 1 year ago

I've been poking around trying to find a way to make it work, that's straightforward, as there's a few 1.19 mods that implement a similar idea, but they mostly utilize mixins or a structure that's just completely incompatible with GeckoLib.

JadedChara commented 1 year ago

Okay, figured I'd update you. I'm in the process of testing this as a procedure, which sure as hell ain't optimal, but thus far the only error that's coming up is that 'event' hasn't been initialized, so my best bet to rectify that issue is just to set up an events folder. I'll share the code once I've figured out how to pull this off.

EDIT: Well, as promised, here's the procedure thus far. I now need to dive into the other aspects of this, but thus far, it's coming out great:

import net.mcreator.pentamorph.PentamorphMod;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.client.event.RenderPlayerEvent;

import net.minecraft.world.entity.player.Player;
import net.minecraftforge.client.event.RenderPlayerEvent.Pre;
import net.minecraftforge.fml.common.Mod;
import net.minecraft.world.item.ItemStack;
import net.minecraft.client.renderer.entity.player.PlayerRenderer;
import net.minecraftforge.event.TickEvent.PlayerTickEvent;
import net.minecraftforge.event.TickEvent.Phase;
import net.minecraftforge.eventbus.api.Event;
import net.minecraftforge.event.TickEvent;

@Mod.EventBusSubscriber
public class QuintusTokenRightclickedOnBlockProcedure {

    //
    @SubscribeEvent
    public static void onPlayerTick(RenderPlayerEvent.Pre event){
        renderShift(event);
    }
    /*
    //initial execution
    @SubscribeEvent
    public static void execute(ItemStack itemstack) {

        RenderPlayerEvent.Pre event;
        //Player player = event.getEntity();
        if((itemstack.getOrCreateTag().getString("character")).equals("Juror")){
            //event.setCanceled(true);
            String character = "Juror";
            renderShift(event, character);
        }
    }
*/
    //render change
    @SubscribeEvent
    public static void renderShift(RenderPlayerEvent.Pre event){
        Player player = event.getEntity();
        event.setCanceled(true);
    }
}

2023-02-28_07 48 25

NerdyPuzzle commented 1 year ago

I already know how this would work, in fact, I already know how to make it work. What is preventing me from implementing it right away is that I would need to make it compatible on servers and it would take time- which is not something I have plenty of.

JadedChara commented 1 year ago

I'd be able to test it for you, since I've already got a testing server for my current projects.

EDIT: https://github.com/CharaHarimata/Pentamorph/blob/master/src/main/java/net/mcreator/pentamorph/procedures/QuintusTokenRightclickedOnBlockProcedure.java

Here's my current thing. I'm thinking of revising it to create an event that calls different entity renderers based on the corresponding variables so it might work on server-side. Unfortunately, the documentation for rendering in general sucks.

JadedChara commented 1 year ago

Okay, I've updated the code with what I've managed to get to work so far. I have absolutely no idea how to apply rotations or animations, though. Any ideas?

JadedChara commented 1 year ago

Another thing that'd be useful, though tricky could be multipart entities. I'm gonna' try and whip up some template files anyway for my project and if you're interested I could share them once done. As for the player model stuff, I'm using the CPM API because there were a few things I couldn't figure out how to go about.

EDIT: I've since forked the repo, and am adding it in slowly but surely. Definitely a process lol.

McModded114 commented 1 year ago

Until this is added, if it ever does, you could just make a model that can work for multiple entities and swap the texture.