Jump to content

Custom Rendering


magmadude21

Recommended Posts

Hello all. I've been trying to create a custom rendered block but it just doesn't want to work. For some reason it's checking in minecraft and not in my model package...

 

The error

 

[21:14:42] [Client thread/ERROR]: Using missing texture, unable to load minecraft:textures/blocks/.png

java.io.FileNotFoundException: minecraft:textures/blocks/.png

at net.minecraft.client.resources.FallbackResourceManager.getResource(FallbackResourceManager.java:65) ~[FallbackResourceManager.class:?]

at net.minecraft.client.resources.SimpleReloadableResourceManager.getResource(SimpleReloadableResourceManager.java:67) ~[simpleReloadableResourceManager.class:?]

at net.minecraft.client.renderer.texture.TextureMap.loadTextureAtlas(TextureMap.java:126) [TextureMap.class:?]

at net.minecraft.client.renderer.texture.TextureMap.loadTexture(TextureMap.java:91) [TextureMap.class:?]

at net.minecraft.client.renderer.texture.TextureManager.loadTexture(TextureManager.java:89) [TextureManager.class:?]

at net.minecraft.client.renderer.texture.TextureManager.loadTickableTexture(TextureManager.java:71) [TextureManager.class:?]

at net.minecraft.client.renderer.texture.TextureManager.loadTextureMap(TextureManager.java:58) [TextureManager.class:?]

at net.minecraft.client.Minecraft.startGame(Minecraft.java:579) [Minecraft.class:?]

at net.minecraft.client.Minecraft.run(Minecraft.java:890) [Minecraft.class:?]

at net.minecraft.client.main.Main.main(Main.java:112) [Main.class:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_51]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_51]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_51]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_51]

at net.minecraft.launchwrapper.Launch.launch(Launch.java:134) [launchwrapper-1.9.jar:?]

at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.9.jar:?]

 

 

 

This is everything in my main mod class that is related to rendering. The rendering happens in the PreInitialization.

 

blockAstralLensBlock = new AstralLens(Material.iron).setBlockName("arcaneLens")

.setBlockTextureName("");

 

GameRegistry.registerBlock(blockAstralLensBlock, "AstralLens");                                          GameRegistry.registerTileEntity(AstralLensTileEntity.class, "Astral Lens");

 

proxy.registerRenderer();

 

 

My block class

 

package net.arcaneengineer.mod.blocks;

 

import net.arcaneengineer.mod.ArcaneEngineer;

import net.arcaneengineer.mod.tileentity.AstralLensTileEntity;

import net.minecraft.block.BlockContainer;

import net.minecraft.block.material.Material;

import net.minecraft.client.renderer.texture.IIconRegister;

import net.minecraft.tileentity.TileEntity;

import net.minecraft.world.World;

import cpw.mods.fml.relauncher.Side;

import cpw.mods.fml.relauncher.SideOnly;

 

public class AstralLens extends BlockContainer{

 

public AstralLens(Material material) {

super(material);

this.setHarvestLevel("pickaxe", 2);

this.setHardness(10.0F);

this.setResistance(20.0F);

this.setCreativeTab(ArcaneEngineer.ArcaneEngineerTab);

 

    }

 

public int GetRenderType() {

 

return -1;

}

 

@Override

public boolean isOpaqueCube() {

 

return false;

}

 

public boolean isRenderedAsNormalBlock() {

 

return false;

}

 

@Override

public TileEntity createNewTileEntity(World var1, int var2) {

return new AstralLensTileEntity();

}

 

 

 

}

 

 

My block renderer

 

package net.arcaneengineer.mod.renderer;

 

import org.lwjgl.opengl.GL11;

 

import cpw.mods.fml.client.FMLClientHandler;

import net.arcaneengineer.mod.ArcaneEngineer;

import net.arcaneengineer.mod.blocks.AstralLens;

import net.arcaneengineer.mod.model.ModelAstralLens;

import net.minecraft.client.Minecraft;

import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;

import net.minecraft.tileentity.TileEntity;

import net.minecraft.util.ResourceLocation;

 

public class AstralLensRenderer extends TileEntitySpecialRenderer{

 

public static final ResourceLocation textureAstralLens = new ResourceLocation(ArcaneEngineer.modID + ":" + "astrallens");

 

 

private ModelAstralLens model;

 

public AstralLensRenderer() {

 

this.model = new ModelAstralLens();

}

 

 

@Override

public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f) {

 

GL11.glPushMatrix();

GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);

GL11.glRotatef(180, 0F, 0F, 1F);

 

Minecraft.getMinecraft().getTextureManager().bindTexture(textureAstralLens);

 

GL11.glPushMatrix();

  this.model.renderModel(0.0625F);

GL11.glPopMatrix();

 

 

GL11.glPopMatrix();

 

}

 

}}

 

 

My item renderer

 

package net.arcaneengineer.mod.renderer;

 

import org.lwjgl.opengl.GL11;

 

import net.arcaneengineer.mod.tileentity.AstralLensTileEntity;

import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;

import net.minecraft.item.ItemStack;

import net.minecraft.tileentity.TileEntity;

import net.minecraftforge.client.IItemRenderer;

 

public class AstralLensItemRenderer implements IItemRenderer {

 

private TileEntitySpecialRenderer render;

private TileEntity entity;

 

public AstralLensItemRenderer(TileEntitySpecialRenderer render, AstralLensTileEntity entity) {

 

this.entity = entity;

this.render = render;

 

}

 

@Override

public boolean handleRenderType(ItemStack item, ItemRenderType type) {

return true;

}

 

@Override

public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {

return true;

}

 

@Override

public void renderItem(ItemRenderType type, ItemStack item, Object... data) {

 

if(type == IItemRenderer.ItemRenderType.ENTITY) {

 

GL11.glTranslatef(-0.5F, 0.0F, -0.5F);

this.render.renderTileEntityAt(this.entity, 0.0D, 0.0D, 0.0D, 0.0F);

}

 

}

 

}

 

 

My model

 

package net.arcaneengineer.mod.model;

 

import net.minecraft.client.model.ModelBase;

import net.minecraft.client.model.ModelRenderer;

import net.minecraft.entity.Entity;

 

public class ModelAstralLens extends ModelBase

{

  //fields

    ModelRenderer oculusfocus;

    ModelRenderer pedestal;

    ModelRenderer pedestalbottom;

    ModelRenderer pedestaltop;

    ModelRenderer oculustable;

    ModelRenderer oculusenhancerone;

    ModelRenderer oculusenhancertwo;

    ModelRenderer oculusenhancerthree;

    ModelRenderer oculusenhancerfour;

    ModelRenderer oculusenhancerfive;

    ModelRenderer oculusenhancersix;

    ModelRenderer oculusenhancerseven;

    ModelRenderer oculusenhancereight;

    ModelRenderer tablesupportone;

    ModelRenderer tablesupporttwo;

    ModelRenderer tablesupportthree;

    ModelRenderer tablesupportfour;

 

  public ModelAstralLens()

  {

    textureWidth = 64;

    textureHeight = 32;

 

      oculusfocus = new ModelRenderer(this, 0, 0);

      oculusfocus.addBox(0F, 0F, 0F, 4, 4, 4);

      oculusfocus.setRotationPoint(-1F, 8F, -3F);

      oculusfocus.setTextureSize(64, 32);

      oculusfocus.setTextureOffset(48, 24);

      oculusfocus.mirror = true;

      setRotation(oculusfocus, 7853982F, 0F, 7853982F);

      pedestal = new ModelRenderer(this, 0, 0);

      pedestal.addBox(0F, 0F, 0F, 4, 7, 4);

      pedestal.setRotationPoint(-2F, 16F, -2F);

      pedestal.setTextureSize(64, 32);

      pedestal.setTextureOffset(0, 14);

      pedestal.mirror = true;

      setRotation(pedestal, 0F, 0F, 0F);

      pedestalbottom = new ModelRenderer(this, 0, 0);

      pedestalbottom.addBox(0F, 0F, 0F, 6, 1, 6);

      pedestalbottom.setRotationPoint(-3F, 23F, -3F);

      pedestalbottom.setTextureSize(64, 32);

      pedestalbottom.setTextureOffset(0, 25);

      pedestalbottom.mirror = true;

      setRotation(pedestalbottom, 0F, 0F, 0F);

      pedestaltop = new ModelRenderer(this, 0, 0);

      pedestaltop.addBox(0F, 0F, 0F, 6, 1, 6);

      pedestaltop.setRotationPoint(-3F, 15F, -3F);

      pedestaltop.setTextureSize(64, 32);

      pedestaltop.setTextureOffset(0, 7);

      pedestaltop.mirror = true;

      setRotation(pedestaltop, 0F, 0F, 0F);

      oculustable = new ModelRenderer(this, 0, 0);

      oculustable.addBox(-5F, 0F, 0F, 10, 1, 10);

      oculustable.setRotationPoint(0F, 14F, -5F);

      oculustable.setTextureSize(64, 32);

      oculustable.setTextureOffset(24, 0);

      oculustable.mirror = true;

      setRotation(oculustable, 0F, 0F, 0F);

      oculusenhancerone = new ModelRenderer(this, 0, 0);

      oculusenhancerone.addBox(0F, 0F, 0F, 1, 5, 1);

      oculusenhancerone.setRotationPoint(-5F, 8F, 4F);

      oculusenhancerone.setTextureSize(64, 32);

      oculusenhancerone.setTextureOffset(28, 13);

      oculusenhancerone.mirror = true;

      setRotation(oculusenhancerone, 0F, 0F, 0F);

      oculusenhancertwo = new ModelRenderer(this, 0, 0);

      oculusenhancertwo.addBox(0F, 0F, 0F, 1, 5, 1);

      oculusenhancertwo.setRotationPoint(4F, 8F, 4F);

      oculusenhancertwo.setTextureSize(64, 32);

      oculusenhancertwo.setTextureOffset(36, 13);

      oculusenhancertwo.mirror = true;

      setRotation(oculusenhancertwo, 0F, 0F, 0F);

      oculusenhancerthree = new ModelRenderer(this, 0, 0);

      oculusenhancerthree.addBox(0F, 0F, 0F, 1, 5, 1);

      oculusenhancerthree.setRotationPoint(4F, 8F, -5F);

      oculusenhancerthree.setTextureSize(64, 32);

      oculusenhancerthree.setTextureOffset(44, 13);

      oculusenhancerthree.mirror = true;

      setRotation(oculusenhancerthree, 0F, 0F, 0F);

      oculusenhancerfour = new ModelRenderer(this, 0, 0);

      oculusenhancerfour.addBox(0F, 0F, 0F, 1, 5, 1);

      oculusenhancerfour.setRotationPoint(-5F, 8F, -5F);

      oculusenhancerfour.setTextureSize(64, 32);

      oculusenhancerfour.setTextureOffset(52, 13);

      oculusenhancerfour.mirror = true;

      setRotation(oculusenhancerfour, 0F, 0F, 0F);

      oculusenhancerfive = new ModelRenderer(this, 0, 0);

      oculusenhancerfive.addBox(0F, 0F, 0F, 2, 1, 2);

      oculusenhancerfive.setRotationPoint(3F, 13F, -5F);

      oculusenhancerfive.setTextureSize(64, 32);

      oculusenhancerfive.setTextureOffset(28, 19);

      oculusenhancerfive.mirror = true;

      setRotation(oculusenhancerfive, 0F, 0F, 0F);

      oculusenhancersix = new ModelRenderer(this, 0, 0);

      oculusenhancersix.addBox(0F, 0F, 0F, 2, 1, 2);

      oculusenhancersix.setRotationPoint(3F, 13F, 3F);

      oculusenhancersix.setTextureSize(64, 32);

      oculusenhancersix.setTextureOffset(36, 19);

      oculusenhancersix.mirror = true;

      setRotation(oculusenhancersix, 0F, 0F, 0F);

      oculusenhancerseven = new ModelRenderer(this, 0, 0);

      oculusenhancerseven.addBox(0F, 0F, 0F, 2, 1, 2);

      oculusenhancerseven.setRotationPoint(-5F, 13F, 3F);

      oculusenhancerseven.setTextureSize(64, 32);

      oculusenhancerseven.setTextureOffset(44, 19);

      oculusenhancerseven.mirror = true;

      setRotation(oculusenhancerseven, 0F, 0F, 0F);

      oculusenhancereight = new ModelRenderer(this, 0, 0);

      oculusenhancereight.addBox(0F, 0F, 0F, 2, 1, 2);

      oculusenhancereight.setRotationPoint(-5F, 13F, -5F);

      oculusenhancereight.setTextureSize(64, 32);

      oculusenhancereight.setTextureOffset(52, 19);

      oculusenhancereight.mirror = true;

      setRotation(oculusenhancereight, 0F, 0F, 0F);

      tablesupportone = new ModelRenderer(this, 0, 0);

      tablesupportone.addBox(0F, 0F, 0F, 1, 9, 1);

      tablesupportone.setRotationPoint(4F, 15F, -5F);

      tablesupportone.setTextureSize(64, 32);

      tablesupportone.setTextureOffset(25, 22);

      tablesupportone.mirror = true;

      setRotation(tablesupportone, 0F, 0F, 0F);

      tablesupporttwo = new ModelRenderer(this, 0, 0);

      tablesupporttwo.addBox(0F, 0F, 0F, 1, 9, 1);

      tablesupporttwo.setRotationPoint(4F, 15F, 4F);

      tablesupporttwo.setTextureSize(64, 32);

      tablesupporttwo.setTextureOffset(31, 22);

      tablesupporttwo.mirror = true;

      setRotation(tablesupporttwo, 0F, 0F, 0F);

      tablesupportthree = new ModelRenderer(this, 0, 0);

      tablesupportthree.addBox(0F, 0F, 0F, 1, 9, 1);

      tablesupportthree.setRotationPoint(-5F, 15F, 4F);

      tablesupportthree.setTextureSize(64, 32);

      tablesupportthree.setTextureOffset(37, 22);

      tablesupportthree.mirror = true;

      setRotation(tablesupportthree, 0F, 0F, 0F);

      tablesupportfour = new ModelRenderer(this, 0, 0);

      tablesupportfour.addBox(0F, 0F, 0F, 1, 9, 1);

      tablesupportfour.setRotationPoint(-5F, 15F, -5F);

      tablesupportfour.setTextureSize(64, 32);

      tablesupportfour.setTextureOffset(43, 22);

      tablesupportfour.mirror = true;

      setRotation(tablesupportfour, 0F, 0F, 0F);

  }

 

  public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)

  {

    super.render(entity, f, f1, f2, f3, f4, f5);

    setRotationAngles(f, f1, f2, f3, f4, f5, entity);

    oculusfocus.render(f5);

    pedestal.render(f5);

    pedestalbottom.render(f5);

    pedestaltop.render(f5);

    oculustable.render(f5);

    oculusenhancerone.render(f5);

    oculusenhancertwo.render(f5);

    oculusenhancerthree.render(f5);

    oculusenhancerfour.render(f5);

    oculusenhancerfive.render(f5);

    oculusenhancersix.render(f5);

    oculusenhancerseven.render(f5);

    oculusenhancereight.render(f5);

    tablesupportone.render(f5);

    tablesupporttwo.render(f5);

    tablesupportthree.render(f5);

    tablesupportfour.render(f5);

  }

 

  public void renderModel(float f) {

  oculusfocus.render(f);

  pedestal.render(f);

  pedestalbottom.render(f);

  pedestaltop.render(f); 

  oculustable.render(f);

  oculusenhancerone.render(f);

  oculusenhancertwo.render(f);

  oculusenhancerthree.render(f);

  oculusenhancerfour.render(f);

  oculusenhancerfive.render(f);

  oculusenhancersix.render(f);

  oculusenhancerseven.render(f);

      oculusenhancereight.render(f);

  tablesupportone.render(f);

  tablesupporttwo.render(f);

  tablesupportthree.render(f);

  tablesupportfour.render(f);

 

  }

 

  private void setRotation(ModelRenderer model, float x, float y, float z)

  {

    model.rotateAngleX = x;

    model.rotateAngleY = y;

    model.rotateAngleZ = z;

  }

 

  public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity)

  {

    super.setRotationAngles(f, f1, f2, f3, f4, f5, entity);

  }

 

}

 

 

Client proxy

 

package net.arcaneengineer.mod.proxy;

 

import cpw.mods.fml.client.registry.ClientRegistry;

import net.arcaneengineer.mod.ArcaneEngineer;

import net.arcaneengineer.mod.renderer.AstralLensItemRenderer;

import net.arcaneengineer.mod.renderer.AstralLensRenderer;

import net.arcaneengineer.mod.tileentity.AstralLensTileEntity;

import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;

import net.minecraft.item.Item;

import net.minecraftforge.client.MinecraftForgeClient;

 

public class ClientProxy extends CommonProxy{

 

@Override

public void registerRenderer() {

 

TileEntitySpecialRenderer render = new AstralLensRenderer();

ClientRegistry.bindTileEntitySpecialRenderer(AstralLensTileEntity.class, render);

MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ArcaneEngineer.blockAstralLensBlock), new AstralLensItemRenderer(render, new AstralLensTileEntity()));

}

 

@Override

public void registerTileEntitySpecialRenderer() {

 

}

 

}

 

Link to comment
Share on other sites

I'm not sure. However your BindTexture looks a little bit messed up in the BlockRendering class. It does require the "filename.png" in that case. So for example, it would be

 

this.bindTexture(new ResourceLocation("modid", "path/to/file.png"));

Link to comment
Share on other sites

With the error thats being thrown its a pretty simple fix, in your main class your .setBlockTextureName is blank.. So the error is giving a blank png, and its going to the minecraft textures. To fix this in your main mod class you should have a modid and this is how your block init should look:

blockAstralLensBlock = new AstralLens(Material.iron).setBlockName("arcaneLens").setBlockTextureName(YourModClass.modid + ":" + "nameOfBlock");

 

This is basic minecraft forge modding, if your having trouble with this simple of an error, I wouldn't post here before checking tons of tutorials.

Link to comment
Share on other sites

Sorry for the late reply. I wasn't able to get on the internet for a couple of days.

 

Now it's actually checking in my model package... That was a derp on my part.

But it still can't load the texture.

 

Basically, it's rendering as a normal block and my model at the same time but without a texture.

Could it be because one of the parts of my model is rotated or outside of the block space?

 

 

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Just a few months ago I was creating my own plugin for Minecraft 1.20.2 spigot that did the same thing, but the skins were not saved, if you can understand this code that I made a long time ago it may help you.   //This is a class method private static String APIRequest(String value, String url, String toSearch) { try { URL api = new URL(url + value); HttpURLConnection connection = (HttpURLConnection) api.openConnection(); connection.setRequestMethod("GET"); int responseCode = connection.getResponseCode(); if (responseCode == HttpURLConnection.HTTP_OK) { BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream())); StringBuilder response = new StringBuilder(); for (String responseChar; (responseChar = reader.readLine()) != null; ) response.append(responseChar); reader.close(); JSONObject responseObject = new JSONObject(response.toString()); if (!toSearch.equals("id")) return responseObject .getJSONArray("properties") .getJSONObject(0) .getString("value"); else return responseObject.getString("id"); } else { AntiGianka.ConsoleMessage(ChatColor.RED, String.format( "Could not get %s. Response code: %s", ((toSearch.equals("id")) ? "UUID" : "texture"), responseCode )); } } catch (MalformedURLException error) { AntiGianka.ConsoleMessage(ChatColor.RED, "An error occurred while trying to access the URL. Error: " + error); } catch (IOException error) { AntiGianka.ConsoleMessage(ChatColor.RED, "An error occurred while attempting to connect to the URL. Error: " + error); } return ""; } //other class method private void SkinGetter() { String uuid; String textureCoded; if ((uuid = APIRequest(args[0], "https://api.mojang.com/users/profiles/minecraft/", "id")).isEmpty() || (textureCoded = APIRequest(uuid, "https://sessionserver.mojang.com/session/minecraft/profile/", "value")).isEmpty() ) sender.sendMessage(ChatColor.RED + String.format( "An error has occurred while trying to obtain the %s player skin, please check if the name %s is spelled correctly or try again later.", args[0], args[0] ) ); else SkinSetter(textureCoded); } //other more private void SkinSetter(String textureCoded) { JSONObject profile = new JSONObject(new String(Base64.getDecoder().decode(textureCoded))); try { URL textureUrl = new URL(profile.getJSONObject("textures"). getJSONObject("SKIN"). getString("url")); if (sender instanceof Player && args.length == 1) { PlayerTextures playerTextures = ((Player) sender).getPlayerProfile().getTextures(); playerTextures.setSkin(textureUrl); ((Player) sender).getPlayerProfile().setTextures(playerTextures); if (((Player) sender).getPlayerProfile().getTextures().getSkin() != null) sender.sendMessage(((Player) sender).getPlayerProfile().getTextures().getSkin().toString()); else sender.sendMessage("Null"); sender.sendMessage("Skin changed successfully.a"); } else { } AntiGianka.ConsoleMessage(ChatColor.GREEN, "Skin command executed successfully."); } catch (MalformedURLException error) { sender.sendMessage(ChatColor.RED + String.format( "An error has occurred while trying to obtain the %s player skin, please check if the name %s is spelled correctly or try again later.", args[0], args[0] ) ); AntiGianka.ConsoleMessage(ChatColor.RED, "An error occurred while trying to access the URL. Error: " + error); } }  
    • Use /locate structure The chat should show all available structures as suggestion For the Ancient City it is /locate structure ancient_city
    • So does it work without this mod? Did you test it with other builds?
    • Make a test without Sophisticated Backpacks or try other builds
    • Hey y'all, first time posting here. I downloaded a server pack off of Curse Forge for E9E to make a modded minecraft server for my friend and I. This is pretty much my first time trying anything like this. Anyways, after sucessfully installing the server pack I try to start it to see if everything is working correctly. In the window prompt it has one line that says it cannot find this file: @libraries.net.minecraftforge.forge.1.19.2-43.2.14.win_args.txt I figured I needed to download the latest version of forge and fully update my java which I did. After retrying it still pops up the same line. I deleted the server pack and redownloaded it and retried but it kept popping the same line. Any ideas or fixes?   Disreguard, got it to work. Wrong version of Java
  • Topics

×
×
  • Create New...

Important Information

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