Jump to content

Recommended Posts

Posted

Well, i have some blocks that don't seem to want to have a texture. IDK what is going wrong

 

Here is my code:

ModBlocks.java:

Spoiler

package com.prisma.block;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.ItemBlock;
import net.minecraftforge.fml.common.registry.GameRegistry;

public class ModBlocks {

    public static BlockOre oreCopper;
    public static BlockBase blockCopper;

    public static void init() {
        oreCopper = register(new BlockOre("oreCopper").setCreativeTab(CreativeTabs.MATERIALS));
        blockCopper = register(new BlockBase(Material.ROCK, "blockCopper").setCreativeTab(CreativeTabs.MATERIALS));
    }

    private static <T extends Block> T register(T block, ItemBlock itemBlock) {
        GameRegistry.register(block);
        GameRegistry.register(itemBlock);

        if (block instanceof BlockBase) {
            ((BlockBase)block).registerItemModel(itemBlock);
        }

        return block;
    }

    private static <T extends Block> T register(T block) {
        ItemBlock itemBlock = new ItemBlock(block);
        itemBlock.setRegistryName(block.getRegistryName());
        return register(block, itemBlock);
    }

}

 

BlockBase.java:

Spoiler

package com.prisma.block;

import com.prisma.main.ProjectPrisma;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.ItemBlock;

public class BlockBase extends Block {

    protected String name;

    public BlockBase(Material material, String name){
        super(material);
        this.name = name;
        setUnlocalizedName(name);
        setRegistryName(name);
    }

    public void registerItemModel(ItemBlock itemBlock){
        ProjectPrisma.proxy.registerItemRenderer(itemBlock, 0, name);
    }

    @Override
    public BlockBase setCreativeTab(CreativeTabs tab){
        super.setCreativeTab(tab);
        return this;
    }
}

 

The JSON of the blockCopper:

Spoiler

{
  "forge_marker": 1,
  "defaults": {
    "textures": {
      "all": "projectprisma:blocks/blockCopper"
    }
  },
  "variants": {
    "normal": {
      "model": "cube_all"
    },
    "inventory": {
      "model": "cube_all"
    }
  }
}

 

And the image is named blockCopper.png

 

i dont know what is going on

Posted

could we see the ProjectPlasma.proxy.registerItemRenderer. Cause I don't see you calling any method along the lines (or event, if you want to go that route) on the client side...

ModelLoader.setCustModelResourceLocation(Item.getItemFromBlock(yourBlockInstance), 0, new ModelResourceLocation(yourBlockInstance.getRegistryName().toString()));

 

Posted

Here is my Client Proxy. I know this works because my items are working as well, should i use a separate one for my blocks?
 

package com.prisma.proxy;

import com.prisma.main.ProjectPrisma;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.item.Item;
import net.minecraftforge.client.model.ModelLoader;

public class ClientProxy extends CommonProxy{
    @Override
    public void registerItemRenderer(Item item, int meta, String id) {
        ModelLoader.setCustomModelResourceLocation(item, meta, new ModelResourceLocation(ProjectPrisma.modId + ":" + id, "inventory"));
    }
}
Posted

Your asset files should be all lower case.

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.

Posted

You might have other problems too, but lower cased asset files have been suggested since 1.7

1.11 enforces it.

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.

Posted (edited)
11 hours ago, xXWitherBossXx said:

Sorry i haven't been able to respond, I am very busy right now since school just ended. Here is the latest log:

pastebin: https://pastebin.com/MvjBHw7N

Caused by: java.io.FileNotFoundException: projectprisma:blockstates/blockCopper.json

Do you have a blockstates file at this location?

Edited by Jay Avery
Posted

Yes, it is required. You already made a blockstates file, you must just have it in the wrong place:

Quote

{
  "forge_marker": 1,
  "defaults": {
    "textures": {
      "all": "projectprisma:blocks/blockCopper"
    }
  },
  "variants": {
    "normal": {
      "model": "cube_all"
    },
    "inventory": {
      "model": "cube_all"
    }
  }
}

 

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.