Jump to content

Recommended Posts

Posted (edited)

Code : 

 

Entity

Spoiler

public class Guy extends TameableEntity {

    protected Guy(EntityType<? extends TameableEntity> type, World worldIn) {
        
        super(type, worldIn);
    }
    
    @Override
    protected void registerAttributes() {
        
        super.registerAttributes();
        
        this.getAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0.45D);
        this.getAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(50); 
    }
    @Override
    public AgeableEntity createChild(AgeableEntity ageable) {

       return null;
    }
}

 

 

Renderer

Spoiler

public class Guy_Renderer extends MobRenderer<Guy, PlayerModel<Guy>> {

	public Guy_Renderer(EntityRendererManager renderManagerIn) {
		
		super(renderManagerIn, new PlayerModel<>(3, false), 0.5F);
	}

	@Override
	protected ResourceLocation getEntityTexture(Guy entity) {
		
		return new ResourceLocation("minecraft", "player");
	}
}

 

 

Factory

Spoiler

public class Guy_Factory implements IRenderFactory<Guy> {
    
    public static final Guy_Factory INSTANCE = new Guy_Factory();
    private Guy_Renderer guy_Renderer;

    @Override
    public EntityRenderer<? super Guy> createRenderFor(EntityRendererManager manager) {
        
        guy_Renderer = new Guy_Renderer(manager);
        
        return guy_Renderer;
    }
}

 

 

Main

Spoiler

private static EntityType<Guy> guy;

private void doClientStuff(final FMLClientSetupEvent event) {
        // do something that can only be done on the client
        LOGGER.info("Got game settings {}", event.getMinecraftSupplier().get().gameSettings);
        
        RenderingRegistry.registerEntityRenderingHandler(Guy.class, Guy_Factory.INSTANCE);
    }

@Mod.EventBusSubscriber(bus=Mod.EventBusSubscriber.Bus.MOD)
    public static class RegistryEvents {
    	
    	@SubscribeEvent
        public static void registerEntities(final RegistryEvent.Register<EntityType<?>> event) {

            LOGGER.debug("Hello from Register Entities");
            
            event.getRegistry().registerAll(
            						
            	guy = register("guy", EntityType.Builder.<Guy>create(Guy::new, EntityClassification.MISC)
            		.setCustomClientFactory((spawnEntity, world) -> new Guy(guy, world)))
            );
        }
        
        @SuppressWarnings("deprecation")
    	private static <T extends Entity> EntityType<T> register(String key, EntityType.Builder<T> builder) {
    	    	
    	    return Registry.register(Registry.ENTITY_TYPE, key, builder.build(key));
    	}  
    }

 

 

Results

 

https://imgur.com/puNc5T7

Edited by MineModder2000
Posted
2 hours ago, MineModder2000 said:

return new ResourceLocation("minecraft", "player");

I don't think that's a texture in vanilla minecraft. This could either point to

assets/minecraft/textures/player.png

Or

assets/minecraft/textures/entity/player.png

 

Both of which I dont think exist.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted
11 hours ago, Animefan8888 said:

I don't think that's a texture in vanilla minecraft. This could either point to

assets/minecraft/textures/player.png

Or

assets/minecraft/textures/entity/player.png

 

Both of which I dont think exist.

How do I make it look like PlayerEntity then? I've tried putting other strings in there too, like "creeper", to no avail. 

Posted
16 minutes ago, MineModder2000 said:

I've tried putting other strings in there too, like "creeper", to no avail.

Look at the vanilla files. You'll notice that they need more than "minecraft" and "creeper"

21 minutes ago, MineModder2000 said:

How do I make it look like PlayerEntity then?

Take a look at PlayerRenderer.

  • Thanks 1

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted
1 hour ago, Animefan8888 said:

Look at the vanilla files. You'll notice that they need more than "minecraft" and "creeper"

Take a look at PlayerRenderer.

Oh boy, I am not going to even be able to get all of that to work. I'd rather just extend PlayerRenderer, but then I can't extend TameableEntity in my Entity class without getting type conversion errors in the Factory class. 

Posted
1 minute ago, MineModder2000 said:

Oh boy, I am not going to even be able to get all of that to work.

Just look at the getEntityTexture method. That will get you the texture.

  • Thanks 1

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted
1 hour ago, Animefan8888 said:

Just look at the getEntityTexture method. That will get you the texture.

Oh I see, it's "Steve". But this doesn't do, the model is correct but it doesn't render correctly as the Renderer class is extending MobRenderer directly and not PlayerRenderer. I don't see that there is any good way to have the Entity extend TameableEntity, while it renders as a Player or other Entity.

Posted
7 hours ago, MineModder2000 said:

Oh I see, it's "Steve"

Well only if the Client has failed to retrieve the texture associated with that account. If you look at the method you'll notice it passes it off to AbstractClientPlayerEntity#getLocationSkin which checks to see if it has the NetworkPlayerInfo and if it does it retrieves the skin from that object. You can replicate this.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted (edited)
On 11/3/2019 at 11:28 PM, Animefan8888 said:

Well only if the Client has failed to retrieve the texture associated with that account. If you look at the method you'll notice it passes it off to AbstractClientPlayerEntity#getLocationSkin which checks to see if it has the NetworkPlayerInfo and if it does it retrieves the skin from that object. You can replicate this.

Right, but it's not enough to have the skin, it doesn't render as it should because I am extending MobRenderer directly without the specifics of PlayerRenderer. But if I extend PlayerRenderer then I can't extend TameableEntity in my Entity class without breaking my Factory class (due to the generic parameters). So I don't think this will be possible. 

Edited by MineModder2000
Posted
7 hours ago, MineModder2000 said:

Right, but it's not enough to have the skin, it doesn't render as it should because I am extending MobRenderer directly without the specifics of PlayerRenderer. But if I extend PlayerRenderer then I can't extend TameableEntity in my Entity class without breaking my Factory class (due to the generic parameters). So I don't think this will be possible. 

Ok? It's called copy and paste or if you dont like that it's called copy what's written. Also all of the rendering is done via a model which you can use any model that extends EntityModel which guess what PlayerModel does extend EntityModel. It's just the layers you have to worry about and the other functions. Also might not want to post the events.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted (edited)
13 hours ago, Animefan8888 said:

Ok? It's called copy and paste or if you dont like that it's called copy what's written. Also all of the rendering is done via a model which you can use any model that extends EntityModel which guess what PlayerModel does extend EntityModel. It's just the layers you have to worry about and the other functions. Also might not want to post the events.

Oh I've attempted this already, this is not a foreign concept to me. Things got ugly, and I couldn't really copy everything due to class dependencies, inaccessible objects and such. Well of course I already knew about the Model classes, did you not see in my Renderer class I am already using PlayerModel. Using the model alone is not enough, its very blocky and out of proportion, the arms especially. 

Edited by MineModder2000

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.