Jump to content

(NEVERMIND) [1.14.4] Custom Entity not Rendering Texture


MineModder2000

Recommended Posts

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
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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. 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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. 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • They were already updated, and just to double check I even did a cleanup and fresh update from that same page. I'm quite sure drivers are not the problem here. 
    • i tried downloading the drivers but it says no AMD graphics hardware has been detected    
    • Update your AMD/ATI drivers - get the drivers from their website - do not update via system  
    • As the title says i keep on crashing on forge 1.20.1 even without any mods downloaded, i have the latest drivers (nvidia) and vanilla minecraft works perfectly fine for me logs: https://pastebin.com/5UR01yG9
    • Hello everyone, I'm making this post to seek help for my modded block, It's a special block called FrozenBlock supposed to take the place of an old block, then after a set amount of ticks, it's supposed to revert its Block State, Entity, data... to the old block like this :  The problem I have is that the system breaks when handling multi blocks (I tried some fix but none of them worked) :  The bug I have identified is that the function "setOldBlockFields" in the item's "setFrozenBlock" function gets called once for the 1st block of multiblock getting frozen (as it should), but gets called a second time BEFORE creating the first FrozenBlock with the data of the 1st block, hence giving the same data to the two FrozenBlock :   Old Block Fields set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=head] BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@73681674 BlockEntityData : id:"minecraft:bed",x:3,y:-60,z:-6} Old Block Fields set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=foot] BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@6d1aa3da BlockEntityData : {id:"minecraft:bed",x:2,y:-60,z:-6} Frozen Block Entity set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=foot] BlockPos{x=3, y=-60, z=-6} BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@6d1aa3da BlockEntityData : {id:"minecraft:bed",x:2,y:-60,z:-6} Frozen Block Entity set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=foot] BlockPos{x=2, y=-60, z=-6} BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@6d1aa3da BlockEntityData : {id:"minecraft:bed",x:2,y:-60,z:-6} here is the code inside my custom "freeze" item :    @Override     public @NotNull InteractionResult useOn(@NotNull UseOnContext pContext) {         if (!pContext.getLevel().isClientSide() && pContext.getHand() == InteractionHand.MAIN_HAND) {             BlockPos blockPos = pContext.getClickedPos();             BlockPos secondBlockPos = getMultiblockPos(blockPos, pContext.getLevel().getBlockState(blockPos));             if (secondBlockPos != null) {                 createFrozenBlock(pContext, secondBlockPos);             }             createFrozenBlock(pContext, blockPos);             return InteractionResult.SUCCESS;         }         return super.useOn(pContext);     }     public static void createFrozenBlock(UseOnContext pContext, BlockPos blockPos) {         BlockState oldState = pContext.getLevel().getBlockState(blockPos);         BlockEntity oldBlockEntity = oldState.hasBlockEntity() ? pContext.getLevel().getBlockEntity(blockPos) : null;         CompoundTag oldBlockEntityData = oldState.hasBlockEntity() ? oldBlockEntity.serializeNBT() : null;         if (oldBlockEntity != null) {             pContext.getLevel().removeBlockEntity(blockPos);         }         BlockState FrozenBlock = setFrozenBlock(oldState, oldBlockEntity, oldBlockEntityData);         pContext.getLevel().setBlockAndUpdate(blockPos, FrozenBlock);     }     public static BlockState setFrozenBlock(BlockState blockState, @Nullable BlockEntity blockEntity, @Nullable CompoundTag blockEntityData) {         BlockState FrozenBlock = BlockRegister.FROZEN_BLOCK.get().defaultBlockState();         ((FrozenBlock) FrozenBlock.getBlock()).setOldBlockFields(blockState, blockEntity, blockEntityData);         return FrozenBlock;     }  
  • Topics

×
×
  • Create New...

Important Information

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