Jump to content

Recommended Posts

Posted (edited)

I have a throwable entity that works great and I am satisfied with the onImpact and onUpdate methods, but It still lacks a render. In it's item form it renders fine, but I cannot figure out how to render its entity state. I looked at the RenderSnowball class, but I cannot understand the constructor, which requires three different objects (RenderManager, Item, RenderItem), but got stuck when I came to the constructor for RenderItem and RenderManager because they both require a TextureManager object (which I do not know how to construct). The problem with the TextureManager is that it requires a IResourceManager object in its constructor, and IResourceManagers are interfaces (I'm inexperienced with interfaces).

 

Can anyone explain to me how to render an EntityThrowable or provide me with an accurate 1.8.9  tutorial? 

Edited by bignose956
Posted (edited)
16 minutes ago, draganz said:

1.8.9 is no longer supported, and help shall not be given on this forum.

Uhhh, you might wan't double check that. 1.8.9 is still on forge (http://files.minecraftforge.net/maven/net/minecraftforge/forge/index_1.8.9.html), and this is the official Forge Forums. Furthermore, I've been receiving help with 1.8.9 this whole week, and you are the only person that has made an unsupported claim about it.

Edited by bignose956
Posted (edited)
4 hours ago, bignose956 said:

I have a throwable entity that works great and I am satisfied with the onImpact and onUpdate methods, but It still lacks a render. In it's item form it renders fine, but I cannot figure out how to render its entity state. I looked at the RenderSnowball class, but I cannot understand the constructor, which requires three different objects (RenderManager, Item, RenderItem), but got stuck when I came to the constructor for RenderItem and RenderManager because they both require a TextureManager object (which I do not know how to construct). The problem with the TextureManager is that it requires a IResourceManager object in its constructor, and IResourceManagers are interfaces (I'm inexperienced with interfaces).

 

Can anyone explain to me how to render an EntityThrowable or provide me with an accurate 1.8.9  tutorial? 

 

You don't create the RenderManager or RenderItem instances yourself, you use the instances Minecraft has already created.

 

To register a Render for an Entity class, call RenderingRegistry.registerEntityRenderingHandler(Class<T>, IRenderFactory<? super T>) in preInit. In the IRenderFactory#createRenderFor implementation, create and return the Render instance.

 

You receive the RenderManager instance as an argument of IRenderFactory#createRenderFor and you can get the RenderItem instance using Minecraft#getRenderItem.

 

This advice applies to all versions from 1.8.9 onwards.

 

 

4 hours ago, bignose956 said:

Uhhh, you might wan't double check that. 1.8.9 is still on forge (http://files.minecraftforge.net/maven/net/minecraftforge/forge/index_1.8.9.html), and this is the official Forge Forums. Furthermore, I've been receiving help with 1.8.9 this whole week, and you are the only person that has made an unsupported claim about it.

 

1.7.10 and earlier are still available for download, but they're not supported on this forum. I believe 1.8.9 is still supported, but you should really update.

Edited by Choonster

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Posted (edited)
18 hours ago, Choonster said:

 

You don't create the RenderManager or RenderItem instances yourself, you use the instances Minecraft has already created.

 

To register a Render for an Entity class, call RenderingRegistry.registerEntityRenderingHandler(Class<T>, IRenderFactory<? super T>) in preInit. In the IRenderFactory#createRenderFor implementation, create and return the Render instance.

 

You receive the RenderManager instance as an argument of IRenderFactory#createRenderFor and you can get the RenderItem instance using Minecraft#getRenderItem.

 

This advice applies to all versions from 1.8.9 onwards.

 

 

 

1.7.10 and earlier are still available for download, but they're not supported on this forum. I believe 1.8.9 is still supported, but you should really update.

Ok, I got this far:

public class RenderRock extends Render<EntityRock>{

	public static Factory FACTORY = new Factory();
	
	protected RenderRock(RenderManager renderManager) {
		super(renderManager);
	}

	@Override
	protected ResourceLocation getEntityTexture(EntityRock entity) {
		return new ResourceLocation(Ref.MOD_ID, "textures/entities/projectile/Rock.png");
	}
	
	public static class Factory implements IRenderFactory<EntityRock>{

        @Override
        public Render<? super EntityRock> createRenderFor(RenderManager manager) {
            return new RenderRock(manager);
        }
    }
}

and the preInit:

@EventHandler
	public void preInit(FMLPreInitializationEvent event)
	{
		
		MinecraftForge.EVENT_BUS.register(handler);
		
		theseBlocks.Init();
		theseBlocks.register();
		theseItems.Init();
		theseItems.register();
		
		RenderingRegistry.registerEntityRenderingHandler(EntityRock.class, RenderRock.FACTORY);
		
	}

But the textures are still not rendering... What am I doing wrong? All my texture images are 16x16 or a multiple. (They render fine as items...)

 

Also, I really despise 1.9 and higher, and could't image "updating" to them, >_<  but thank you for the advice =)

Edited by bignose956
Posted
5 hours ago, bignose956 said:

Also, I really despise 1.9 and higher, and could't image "updating" to them, >_<

Why? There are no reasons to stay on the outdated versions. Especially now, with the community actively wanting to set 1.12 as the "mainstream" version. There are modpacks for it already for crying out loud, we don't even have a stable forge yet...

No one is going to use your mod if it is that outdated.

 

5 hours ago, bignose956 said:

What am I doing wrong?

Well, you've registered your renderer. Are you maybe going to do something in there? You know, by default an implementation of Render is not going to do anything. You need to provide it with code that it will use to render something. You currently have only defined the textures used for rendering, but you are not telling the game how to render your entity.

Maybe you could use an implementation of RenderSnowball that renders your rock instead of the snowball? Please explain what you want your entity to look like.

Posted (edited)
57 minutes ago, V0idWa1k3r said:

Why? There are no reasons to stay on the outdated versions. Especially now, with the community actively wanting to set 1.12 as the "mainstream" version. There are modpacks for it already for crying out loud, we don't even have a stable forge yet...

No one is going to use your mod if it is that outdated.


I wouldn't use the term "outdated", because a lot of negative features were added post 1.8. Minecraft used to be a noob friendly sandbox game, and was transformed into a complicated RPG with too many options. I specifically hate this because it is forcing players like myself to update, when indeed we dislike the "new content". I don't like any of the combat 'improvements', the elytra thing is nothing like Minecraft (especially if you're from the 1.3 era). I believe that the updates should have been kept simple, and none should have changed the game fundamentals. If players want this, they can always build or download a mod. But now we are basically being forced to use mods we are not interested in.

 

57 minutes ago, V0idWa1k3r said:

Well, you've registered your renderer. Are you maybe going to do something in there? You know, by default an implementation of Render is not going to do anything. You need to provide it with code that it will use to render something. You currently have only defined the textures used for rendering, but you are not telling the game how to render your entity.

Maybe you could use an implementation of RenderSnowball that renders your rock instead of the snowball? Please explain what you want your entity to look like.

I want my entity to be the same as a snowball as in its render is the same as it's item form, and it is "2D" from all angles. I tried this: 

public void doRender(EntityRock entity, double x, double y, double z, float entityYaw, float partialTicks)
    {
        GlStateManager.pushMatrix();
        GlStateManager.translate((float)x, (float)y, (float)z);
        GlStateManager.enableRescaleNormal();
        GlStateManager.scale(0.5F, 0.5F, 0.5F);
        GlStateManager.rotate(-this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
        GlStateManager.rotate(this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
        this.bindTexture(getEntityTexture(entity));
        this.theRenderItem.renderItem(this.getItemStack(entity), ItemCameraTransforms.TransformType.GROUND);
        GlStateManager.disableRescaleNormal();
        GlStateManager.popMatrix();
        super.doRender(entity, x, y, z, entityYaw, partialTicks);
    }

but I got a nullpointer at 

this.theRenderItem.renderItem(this.getItemStack(entity), ItemCameraTransforms.TransformType.GROUND);

 

Edited by bignose956
Posted
1 minute ago, bignose956 said:

I want my entity to be the same as a snowball as in its render is the same as it's item form, and it is "2D" from all angles.

It seems that you can simply return a new instance of RenderSnowball then. Look at it's constructor. You already have your RenderManager in your factory, the Item is your item(the rock) and you can obtain an instance of RenderItem at Minecraft::getRenderItem

Posted
28 minutes ago, V0idWa1k3r said:

It seems that you can simply return a new instance of RenderSnowball then. Look at it's constructor. You already have your RenderManager in your factory, the Item is your item(the rock) and you can obtain an instance of RenderItem at Minecraft::getRenderItem

I didn't understand that at all ???

Posted

In your render factory (the RenderRock.Factory subclass), in it's 

6 hours ago, bignose956 said:

createRenderFor

method return a new instance of RenderSnowball(new RenderSnowball). It's constructor takes 3 parameters.

1. a RenderManager. You already have one(it is the only parameter of the createRenderFor method)

2. an Item. That is the item you want the texture of to render. In your case it is your Rock item if you have one. I do not know where do you keep your item references so I can't give you a code snippet to use.

3. a RenderItem. You can obtain one using Minecraft.getMinecraft().getRenderItem().

If you want your item to render as a snowball but with a different texture you might aswell use snowball's renderer instead of writing your own.

  • Like 1
  • 2 weeks later...
Posted
On 6/13/2017 at 3:25 AM, V0idWa1k3r said:

In your render factory (the RenderRock.Factory subclass), in it's 

method return a new instance of RenderSnowball(new RenderSnowball). It's constructor takes 3 parameters.

1. a RenderManager. You already have one(it is the only parameter of the createRenderFor method)

2. an Item. That is the item you want the texture of to render. In your case it is your Rock item if you have one. I do not know where do you keep your item references so I can't give you a code snippet to use.

3. a RenderItem. You can obtain one using Minecraft.getMinecraft().getRenderItem().

If you want your item to render as a snowball but with a different texture you might aswell use snowball's renderer instead of writing your own.

Ohh!! I got it! Thanks!

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

    • This is the last line before the crash: [ebwizardry]: Synchronising spell emitters for PixelTraveler But I have no idea what this means
    • What in particular? I barely used that mod this time around, and it's never been a problem in the past.
    • Im trying to build my mod using shade since i use the luaj library however i keep getting this error Reason: Task ':reobfJar' uses this output of task ':shadowJar' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. So i try adding reobfJar.dependsOn shadowJar  Could not get unknown property 'reobfJar' for object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler. my gradle file plugins { id 'eclipse' id 'idea' id 'maven-publish' id 'net.minecraftforge.gradle' version '[6.0,6.2)' id 'com.github.johnrengelman.shadow' version '7.1.2' id 'org.spongepowered.mixin' version '0.7.+' } apply plugin: 'net.minecraftforge.gradle' apply plugin: 'org.spongepowered.mixin' apply plugin: 'com.github.johnrengelman.shadow' version = mod_version group = mod_group_id base { archivesName = mod_id } // Mojang ships Java 17 to end users in 1.18+, so your mod should target Java 17. java.toolchain.languageVersion = JavaLanguageVersion.of(17) //jarJar.enable() println "Java: ${System.getProperty 'java.version'}, JVM: ${System.getProperty 'java.vm.version'} (${System.getProperty 'java.vendor'}), Arch: ${System.getProperty 'os.arch'}" minecraft { mappings channel: mapping_channel, version: mapping_version copyIdeResources = true runs { configureEach { workingDirectory project.file('run') property 'forge.logging.markers', 'REGISTRIES' property 'forge.logging.console.level', 'debug' arg "-mixin.config=derp.mixin.json" mods { "${mod_id}" { source sourceSets.main } } } client { // Comma-separated list of namespaces to load gametests from. Empty = all namespaces. property 'forge.enabledGameTestNamespaces', mod_id } server { property 'forge.enabledGameTestNamespaces', mod_id args '--nogui' } gameTestServer { property 'forge.enabledGameTestNamespaces', mod_id } data { workingDirectory project.file('run-data') args '--mod', mod_id, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/') } } } sourceSets.main.resources { srcDir 'src/generated/resources' } repositories { flatDir { dirs './libs' } maven { url = "https://jitpack.io" } } configurations { shade implementation.extendsFrom shade } dependencies { minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}" implementation 'org.luaj:luaj-jse-3.0.2' implementation fg.deobf("com.github.Virtuoel:Pehkui:${pehkui_version}") annotationProcessor 'org.spongepowered:mixin:0.8.5:processor' minecraftLibrary 'luaj:luaj-jse:3.0.2' shade 'luaj:luaj-jse:3.0.2' } // Example for how to get properties into the manifest for reading at runtime. tasks.named('jar', Jar).configure { manifest { attributes([ 'Specification-Title' : mod_id, 'Specification-Vendor' : mod_authors, 'Specification-Version' : '1', // We are version 1 of ourselves 'Implementation-Title' : project.name, 'Implementation-Version' : project.jar.archiveVersion, 'Implementation-Vendor' : mod_authors, 'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"), "TweakClass" : "org.spongepowered.asm.launch.MixinTweaker", "TweakOrder" : 0, "MixinConfigs" : "derp.mixin.json" ]) } rename 'mixin.refmap.json', 'derp.mixin-refmap.json' } shadowJar { archiveClassifier = '' configurations = [project.configurations.shade] finalizedBy 'reobfShadowJar' } assemble.dependsOn shadowJar reobf { re shadowJar {} } publishing { publications { mavenJava(MavenPublication) { artifact jar } } repositories { maven { url "file://${project.projectDir}/mcmodsrepo" } } } my entire project:https://github.com/kevin051606/DERP-Mod/tree/Derp-1.0-1.20
    • All versions of Minecraft Forge suddenly black screen even without mods (tried reinstalling original Minecraft, Java, updating drivers doesn't work)
  • Topics

×
×
  • Create New...

Important Information

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