Jump to content

[1.16] Overwrite player


RobinCirex

Recommended Posts

Hey,

I'm trying to make an animated player model using GeckoLib. For that, the player has to implement the interface "IAnimatable". How do I overwrite the player class so I can implement it? 
This is what I've tried

package me.cirex.titans.entity;

import com.mojang.authlib.GameProfile;

import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import software.bernie.geckolib3.core.IAnimatable;
import software.bernie.geckolib3.core.manager.AnimationData;
import software.bernie.geckolib3.core.manager.AnimationFactory;

public class CustomPlayerEntity extends PlayerEntity implements IAnimatable {

	public CustomPlayerEntity(World p_i241920_1_, BlockPos p_i241920_2_, float p_i241920_3_, GameProfile p_i241920_4_) {
		super(p_i241920_1_, p_i241920_2_, p_i241920_3_, p_i241920_4_);
		System.out.println("Player was created");
	}

	@Override
	public boolean isSpectator() {
		return false;
	}

	@Override
	public boolean isCreative() {
		return false;
	}

	@Override
	public void tick() {
		System.out.println("test");
		super.tick();
	}

	@Override
	public void registerControllers(AnimationData data) {
		
	}

	@Override
	public AnimationFactory getFactory() {
		return null;
	}

}
package me.cirex.titans.registry;

import me.cirex.titans.entity.CustomPlayerEntity;
import net.minecraft.entity.EntityClassification;
import net.minecraft.entity.EntityType;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;

public class TitanRegistry {

	public static final EntityType<?> playerType = EntityType.Builder
			.<CustomPlayerEntity>create(EntityClassification.MISC).disableSerialization().disableSummoning()
			.size(0.6F, 1.8F).trackingRange(32).func_233608_b_(2).build("minecraft:player").setRegistryName("minecraft:player");

	@SubscribeEvent
	public void onRegisterEntity(RegistryEvent.Register<EntityType<?>> event) {
		if(event.getName().getPath().equalsIgnoreCase("player")) {
			event.setCanceled(true);
		}
		
		event.getRegistry().register(playerType);
	}

}

 

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



×
×
  • Create New...

Important Information

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