Jump to content

public void Solved(FMLPreInitializationEvent event), one final question


crazyjackel

Recommended Posts

okay choonstar in the last post you attempt to explain how to do modelloader, trust me i got lost, but anyway this is a new post about the white box and how to fix

 

first attempt to bind a texture: -failed

public class RenderEssenceSplash extends RenderSnowball
{

public RenderEssenceSplash(RenderManager renderManagerIn) {
	super(renderManagerIn, Main.EssenceSplash, Minecraft.getMinecraft().getRenderItem());
	this.bindTexture(new ResourceLocation("essence:EssenceSplash"));
}
}

second attempt: -failrf


public class RenderEssenceSplash extends RenderSnowball
{

public RenderEssenceSplash(RenderManager renderManagerIn) {
	super(renderManagerIn, Main.EssenceSplash, Minecraft.getMinecraft().getRenderItem());

}
@Override
public void doRender(Entity entity, double x, double y, double z, float entityYaw, float partialTicks){
	this.bindTexture(new ResourceLocation("essence:EssenceSplash"));
}
}

third attempt: -failed

public class RenderEssenceSplash extends RenderSnowball
{

public RenderEssenceSplash(RenderManager renderManagerIn) {
	super(renderManagerIn, Main.EssenceSplash, Minecraft.getMinecraft().getRenderItem());

}
public void doRender(){
	this.bindTexture(new ResourceLocation("essence:EssenceSplash"));
}
}

 

at least 15 other attempts - failed

 

so yeah i am rendering and also attempting to bind texture, but the texture isnt being bound, dont really understand why it isnt working as the ResourceLocation worked when i was binding it for

Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register

 

i still dont understand ModelLoader and ModelBakery

Link to comment
Share on other sites

If you want to change the texture used to render an entity, override

Render#getEntityTexture

. That's not what you want to do here though.

 

RenderSnowball

already handles the model and texture for you, you just need to pass it the right

Item

in the constructor (and override

RenderSnowball#getStackToRender

if you want to use custom metadata/NBT/capabilities).

 

If an entity is rendering as a white box, it hasn't had a

Render

registered for it. You must do this by calling

RenderingRegistry#registerEntityRenderingHandler(Class<T>, IRenderFactory<? super T>)

in preInit.

 

The

ModelResourceLocation

passed to

ItemModelMesher#register

or

ModelLoader.setCustomModelResourceLocation

points to a model (the clue is in the name).

Render#bindTexture

expects the

ResourceLocation

to point to a texture. Textures and models are not the same thing.

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.

Link to comment
Share on other sites

diesieben07 answered before I could (and noticed that you were handling the wrong event), but here are some other things that I noticed:

  • Entity

    isn't a singleton class like

    Block

    ,

    Item

    or

    Potion

    ; don't store an instance of it (or a subclass) in a static field.

  • Don't bother having a
    PreInitializationEvent

    parameter in

    Common#preInit

    if you're just going to pass

    null

    . Either pass a real value or remove the parameter.

  • Your package name should include your name and your mod name (e.g.
    com.<yourname>.<modname>

    ). Don't use

    src

    in the package name.

  • You should follow Java naming conventions:
    PascalCase

    for class, interface and enum names;

    camelCase

    for field, method, parameter and local variable names and

    UPPER_CASE

    for constants.

  • You should also follow MCP naming conventions by prefixing your class names with the supertype, e.g.
    ItemMormonBook

    rather than

    MormonBookItem

    .

  • Your proxy classes should have "proxy" somewhere in the class or package name.

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.

Link to comment
Share on other sites

hey choonstar (or someone else) can you send me the list of mcp naming conventions, just so in the future it will be easier to understand my buggy code

 

There is no list, it's mainly just the one convention (prefix your class names with the super type). For examples, simply look at the vanilla class names; these are all assigned by MCP.

 

This section of Forge's official documentation briefly outlines the recommended way to structure your mod, including how to name your classes.

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.

Link to comment
Share on other sites

Your package name should include your name and your mod name (e.g.
com.<yourname>.<modname>

).

Since I see you mention this again, I have to say this:

If you don't own "xyz.com", do not use "com.xyz" as your package name. Package names are tied to domain names. Many people use "me.<name>", but I would prefer "mod.<modID>", since "mod" is not a real TLD.

 

That's a good point. I should probably repackage my code at some point.

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.

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.