Jump to content

1.16.5 Custom Minecart entity is invisible and interactable


Recommended Posts

Hi, I'm trying to create an entity based of a minecart but the entity appears to be invisible and unable to be interacted with. I'm not seeing any errors in the debug log. I have included my entity and renderer. I have not added any attributes to this entity as I don't think there is any way to add them to minecarts. I added a message during ticks that appears when its alive but the minecart itself does not.

public class TrainEntity extends AbstractMinecartEntity {
	public TrainEntity(EntityType<?> p_i50126_1_, World p_i50126_2_) {
		super(p_i50126_1_, p_i50126_2_);

	public TrainEntity(World p_i1723_1_, double p_i1723_2_, double p_i1723_4_, double p_i1723_6_) {
		super(EntityRegister.TRAINENTITY.get(), p_i1723_1_, p_i1723_2_, p_i1723_4_, p_i1723_6_);
	public static final String REG = "train_entity";
	public Type getMinecartType() {
		return AbstractMinecartEntity.Type.RIDEABLE;
	public ActionResultType interact(PlayerEntity p_184230_1_, Hand p_184230_2_) {
	    ActionResultType ret = super.interact(p_184230_1_, p_184230_2_);
	    if (ret.consumesAction()) return ret;
	    if (p_184230_1_.isSecondaryUseActive()) {
	       return ActionResultType.PASS;
	    } else if (this.isVehicle()) {
	       return ActionResultType.PASS;
	    } else if (!this.level.isClientSide) {
	       return p_184230_1_.startRiding(this) ? ActionResultType.CONSUME : ActionResultType.PASS;
	    } else {
	       return ActionResultType.SUCCESS;
	public void tick() {
		STAR.LOGGER.debug("STAR - Training Hard");
public class TrainEntityRender<T extends TrainEntity> extends EntityRenderer<T> {
	protected final EntityModel<T> model = new CreeperModel<>();
	public TrainEntityRender(EntityRendererManager p_i46155_1_) {
		 this.shadowRadius = 0.7F;

	public ResourceLocation getTextureLocation(TrainEntity p_110775_1_) {
		return new ResourceLocation(STAR.MODID, "textures/entity/purple_thing.png");
	public void render(T p_225623_1_, float p_225623_2_, float p_225623_3_, MatrixStack p_225623_4_, IRenderTypeBuffer p_225623_5_, int p_225623_6_) {
	      super.render(p_225623_1_, p_225623_2_, p_225623_3_, p_225623_4_, p_225623_5_, p_225623_6_);
  			//Bunch of other stuff copied from the MinecartRenderer

	      p_225623_4_.scale(-1.0F, -1.0F, 1.0F);
	      this.model.setupAnim(p_225623_1_, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F);
	      IVertexBuilder ivertexbuilder = p_225623_5_.getBuffer(this.model.renderType(this.getTextureLocation(p_225623_1_)));
	      this.model.renderToBuffer(p_225623_4_, ivertexbuilder, p_225623_6_, OverlayTexture.NO_OVERLAY, 1.0F, 1.0F, 1.0F, 1.0F);
	      STAR.LOGGER.debug("STAR - RENDER");
	 protected void renderMinecartContents(T p_225630_1_, float p_225630_2_, BlockState p_225630_3_, MatrixStack p_225630_4_, IRenderTypeBuffer p_225630_5_, int p_225630_6_) {
		      Minecraft.getInstance().getBlockRenderer().renderSingleBlock(p_225630_3_, p_225630_4_, p_225630_5_, p_225630_6_, OverlayTexture.NO_OVERLAY);


Event Register:

    public static void onClientSetupEvent(FMLClientSetupEvent event) {
    	LOGGER.info("STAR - Client Setup");
    	//Other renderers
    	RenderingRegistry.registerEntityRenderingHandler(EntityRegister.TRAINENTITY.get(), TrainEntityRender::new);   

Any help would be greatly appreciated. 

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.

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.

  • Create New...

Important Information

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