Jump to content

[1.12.2] Simplest way to render a moving object?


nocot

Recommended Posts

I'm creating a train mod and I need to place a train object that will change its position every frame (to look like it's moving). I found two modelling programs - Tabula and Workbench. The first one creates a class file that is probably a tesselator instruction set. The second one can create .json and .obj file. All I want is to render a model in a fixed position and rotation that can change every frame.

 

So I mean, I just want to call some function like this every frame:

@SubscribeEvent
public int renderTrain(blahblahEveryFrameEvent event)
{
	renderTrain(MY_MODEL, XPOS, YPOS, ZPOS, ...);
}

 

What is the simplest way through loading model and displaying it by calling a function? Do I really have to mess with all the tile entity stuff?

Or there is somehow no need to call that function manually?

Link to comment
Share on other sites

Are you trying to render an entity or are you rendering the train into at GUI or straight into the HUD?

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

2 minutes ago, nocot said:

I'm trying to render a train as a normal 3D object, just as any other block or item in the world; so not as the part of HUD. Is it possible to render it as a 3D item, in a player independent position?

Yes. And does it have to be non cuboud? If not I reccomend using the animation system along with a json and you will need a Tile Entity for this either way.

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

5 minutes ago, nocot said:

I'm trying to render a train as a normal 3D object, just as any other block or item in the world; so not as the part of HUD. Is it possible to render it as a 3D item, in a player independent position?

Your train is a block?

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

I'm still on deep research part, so I haven't started writing a mod for good. I think a train cannot be loaded as a block if it has to be moveable - but maybe I'm wrong and something has changed.

 

I know that entity stuff will come for me with writing a train physics and so on, but I still think that making an entity just for displaying a 3D model is a way too complicated and I look for other methods.

 

So, making a train an item isn't that bad idea? I heard that a minecart did something like that too.

Link to comment
Share on other sites

1 minute ago, nocot said:

I'm still on deep research part, so I haven't started writing a mod for good. I think a train cannot be loaded as a block if it has to be moveable - but maybe I'm wrong and something has changed.

 

I know that entity stuff will come for me with writing a train physics and so on, but I still think that making an entity just for displaying a 3D model is a way too complicated and I look for other methods.

 

So, making a train an item isn't that bad idea? I heard that a minecart did something like that too.

What????? Forgive the question marks I don’t understand what your saying.

your options are.

1) block - can’t move, occupies physical space in the world

2) item - can’t move, doesn’t occupy space in the world

3) rendering into the GUI - even worse than item

4) entity - movable, rideable, large control over rendering, occupies space in the world

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

Ahh yeah, forgive me, I'm just a begginner and I just don't understand many things that good. But that's my bad.

 

I must have misinterpretated informations about entities that I've searched, so I must go back and study about it. I think, that's it.

Link to comment
Share on other sites

30 minutes ago, nocot said:

Ahh yeah, forgive me, I'm just a begginner and I just don't understand many things that good. But that's my bad.

 

I must have misinterpretated informations about entities that I've searched, so I must go back and study about it. I think, that's it.

Well do you want it to freely move around the world/like a minecart? Or will it be stationary like a model train? Use a custom entity for the first one which can be rendered with any of the proposed methods, though a Java model file might be easiest to implement. But if you feel you need to go back and study a bit more that is fine.

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

Thank you for the answer. Well, it has to be moving around the world by a track, like a minecart. So I think I'll start with creating an entity based on minecart's one and slightly modifying it. I think it will be a good point to start with entities and to better understand them.

Link to comment
Share on other sites

17 minutes ago, nocot said:

Thank you for the answer. Well, it has to be moving around the world by a track, like a minecart. So I think I'll start with creating an entity based on minecart's one and slightly modifying it. I think it will be a good point to start with entities and to better understand them.

Just make a basic entity that extends Minecraft rideable & register it & get it to work, then go into rendering

  • Thanks 1

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

Hello again. I copied ItemMinecart to my own item which I called ItemTram so I can use it like a normal minecart placer. Then I created an entity which temporarly just extends EntityMinecart and do nothing more. The problem started when I tried to change an entity calling function in my ItemTram class:

 

EntityMinecart entityminecart = EntityMinecart.create(world, d0, d1 + d3, d2, ((ItemMinecart)stack.getItem()).minecartType);

to call my new entity:

EntityTram entityminecart = EntityTram.create(world, d0, d1 + d3, d2, ((ItemTram)stack.getItem()).minecartType);

 

and my entity is:

package com.kg.transportmod;

import net.minecraft.entity.item.EntityMinecart;
import net.minecraft.util.DamageSource;
import net.minecraft.world.World;

public class EntityTram extends EntityMinecart{
  
	public EntityTram(World worldIn, double x, double y, double z, EntityTram.Type type) {
		super(worldIn, x, y, z);
	}

	@Override
	public Type getType() {
		return null;
	}
}

 

Eclipse just gives me an answer that entity tram is not compatible with entity minecart. I can cast to entity tram but a Minecraft gives then a runtime error that it can't be casted to entity tram. What am I doing wrong? Isn't that the way I can copy an entity?

Link to comment
Share on other sites

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

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.