Jump to content

Recommended Posts

Posted

Hi,

I'm trying to create a new block and it is working fine in the inventory! But as soon as I place this block ist has this "Missing Texture"-texture.
I searched alot and I still don't know my failure :(

Here are some resources:

assets/tekklands/blockstates/block_ore_tekknium_infused_diamond.json: (Blockstate)

Spoiler

{
  "forge_marker": 1,
  "defaults": {
    "model": "cube_all",
    "transform": "forge:default-block"
  },
  "variants": {
    "inventory": [
      {
        "textures": {
          "all": "tekklands:blocks/tekknium_infused_diamond_ore"
        }
      }
    ],
    "normal": [
      {
        "textures": {
          "all": "tekklands:blocks/tekknium_infused_diamond_ore"
        }
      }
    ]
  }
}

 

 

assets/tekklands/models/block/block_ore_tekknium_infused_diamond.json: (Block model)

Spoiler

{
  "parent": "block/cube_all",
  "textures": {
    "all": "tekklands:blocks/tekknium_infused_diamond_ore"
  }
}

 

 

And JavaCode:
BlockBase:

Spoiler

package net.jan.tekklands.blocks;

import net.jan.tekklands.TekklandsMod;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;

public class BlockBase extends Block {

    protected String name;

    public BlockBase(Material material, String unlocalizedName, String registryMame) {
        super(material);
        this.name = unlocalizedName;
        setUnlocalizedName(unlocalizedName);
        setRegistryName(registryMame);
        setCreativeTab(TekklandsMod.TEKKLANDS_TAB);
    }

    public void registerItemModel(Item itemBlock) {
        TekklandsMod.proxy.registerItemRenderer(itemBlock, 0, name);
    }

    public Item createItemBlock() {
        return new ItemBlock(this).setRegistryName(getRegistryName());
    }

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

    @Override
    public BlockBase setResistance(float resistance) {
        super.setResistance(resistance);
        return this;
    }

    @Override
    public BlockBase setHardness(float hardness) {
        super.setHardness(hardness);
        return this;
    }
}

 

 

TekklandsBlocks:

Spoiler

package net.jan.tekklands.blocks;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.item.Item;
import net.minecraftforge.registries.IForgeRegistry;

public class TekklandsBlocks {

    public static BlockBase tekkniumInfusedDiamondOre =
            new BlockBase(Material.ROCK, "block_ore_tekknium_infused_diamond", "blockOreTekkniumInfusedDiamond").setResistance(5F).setHardness(3F);

    public static void register(IForgeRegistry<Block> registry) {
        registry.register(tekkniumInfusedDiamondOre);
    }

    public static void registerItemBlocks(IForgeRegistry<Item> registry) {
        registry.register(tekkniumInfusedDiamondOre.createItemBlock());
    }

    public static void registerModels() {
        tekkniumInfusedDiamondOre.registerItemModel(Item.getItemFromBlock(tekkniumInfusedDiamondOre));
    }

}

 

 

ClientProxy:

Spoiler

package net.jan.tekklands.proxy;

import net.jan.tekklands.TekklandsMod;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.item.Item;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

@SideOnly(Side.CLIENT)
public class ClientProxy extends CommonProxy {

    @Override
    public void registerItemRenderer(Item item, int meta, String id) {
        ModelLoader.setCustomModelResourceLocation(item, meta, new ModelResourceLocation(TekklandsMod.MOD_ID + ":" + id, "inventory"));
    }
}

 

 

TekklandsMod:

Spoiler

package net.jan.tekklands;

import net.jan.tekklands.blocks.TekklandsBlocks;
import net.jan.tekklands.items.TekklandsItems;
import net.jan.tekklands.proxy.CommonProxy;
import net.jan.tekklands.util.Utils;
import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.NonNullList;
import net.minecraftforge.client.event.ModelRegistryEvent;
import net.minecraftforge.fml.common.DummyModContainer;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.SidedProxy;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

@Mod(
        modid = TekklandsMod.MOD_ID,
        name = TekklandsMod.MOD_NAME,
        version = TekklandsMod.VERSION
)
public class TekklandsMod {

    public static final String MOD_ID = "tekklands";
    public static final String MOD_NAME = "Tekklands";
    public static final String VERSION = "0.0.1-ALPHA";

    public static final CreativeTabs TEKKLANDS_TAB = new CreativeTabs("Tekklands") {

        {
            setBackgroundImageName("item_search.png");
        }

        @Override
        public ItemStack getTabIconItem() {
            return new ItemStack(TekklandsItems.itemTekkniumInfusedDiamond);
        }

        @Override
        public boolean hasSearchBar() {
            return true;
        }
    };

    @Mod.Instance(MOD_ID)
    public static TekklandsMod INSTANCE;

    @SidedProxy(serverSide = "net.jan.tekklands.proxy.CommonProxy", clientSide = "net.jan.tekklands.proxy.ClientProxy")
    public static CommonProxy proxy;

    @Mod.EventHandler
    public void preinit(FMLPreInitializationEvent event) {

    }

    @Mod.EventHandler
    public void init(FMLInitializationEvent event) {

    }

    @Mod.EventHandler
    public void postinit(FMLPostInitializationEvent event) {

    }

    @Mod.EventBusSubscriber
    public static class ObjectRegistryHandler {

        @SubscribeEvent
        public static void addItems(RegistryEvent.Register<Item> event) {
            TekklandsItems.register(event.getRegistry());
            TekklandsBlocks.registerItemBlocks(event.getRegistry());
        }


        @SubscribeEvent
        public static void addModels(ModelRegistryEvent event) {
            TekklandsItems.registerModels();
            TekklandsBlocks.registerModels();
        }

        @SubscribeEvent
        public static void addBlocks(RegistryEvent.Register<Block> event) {
            TekklandsBlocks.register(event.getRegistry());
        }
    }
}

 

 

Well, and one Screenshot:

Spoiler

Uhm, attached ;)

 

2018-01-01_16.57.27.png

Posted (edited)
  1. Problematic Code #1
    Do not register your blocks/items by calling IForgeRegistry::register.
  2. Instead of creating your ModelResourceLocation as modid+":"+id, just call Item::getRegistryName. It has already been formatted to "modid:id" for you "behind the curtains"
  3. Please also add the fml-client-latest.log found in <modding-directory>/run/logs.
    Paste the contents to pastebin.com or as a github Gist. Please do not upload the file directly here, or copy/paste the contents as a post.

 

Edited by Matryoshika

Also previously known as eAndPi.

"Pi, is there a station coming up where we can board your train of thought?" -Kronnn

Published Mods: Underworld

Handy links: Vic_'s Forge events Own WIP Tutorials.

Posted

Registering blocks & Items using the Register<IForgeRegistry> events
Registering models during the ModelRegistryEvent

 

oh, I missed one thing earlier.
You never in any way connect the BlockState JSON to the model JSON.
You're just stating "use this texture".
Inside the variant "normal" [{}] in your BlockState, add a "model": "modid:name".

Example: "normal": [{ "model": "underworld:blockbrazier" }}

 

(It seems like you're in-between different formats. One that declares everything inside the BlockState JSON (which doesn't need any models) and one that makes use of a ready model JSON. I took the liberty of directing you to make full use of the second option, as you already had a JSON for that.)

Also previously known as eAndPi.

"Pi, is there a station coming up where we can board your train of thought?" -Kronnn

Published Mods: Underworld

Handy links: Vic_'s Forge events Own WIP Tutorials.

Posted
22 minutes ago, Janrupf said:

item's and block's

Your item's and block's what?

 

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)

I think I understood something wrong:

assets/tekklands/blockstates/block_ore_tekknium_infused_diamond.json: (Blockstate)

{
  "forge_marker": 1,
  "defaults": {
    "model": "cube_all",
    "transform": "forge:default-block"
  },
  "variants": {
    "inventory": [
      {
        "textures": {
          "all": "tekklands:blocks/tekknium_infused_diamond_ore"
        }
      }
    ],
    "normal": [
      {
        "model": "tekklands:block_ore_tekknium_infused_diamond"
      }
    ]
  }
}
I didnd't change the the model json but now it is this big block without any texture or model.
Edited by Janrupf
Posted
21 minutes ago, Janrupf said:

Oh come on :P I'm not englisch ^^

Some people are and they still use the apostrophe wrong.

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
4 hours ago, LeoCTH said:

.........

why you use forge blockstates?

vanilla blockstates are enough to handle it

The Forge blockstate format is version based ("forge_marker": 1, AKA version 1), which is pretty much guaranteed to be backwards compatibly, while the vanilla version isn't.

 

@OP you only set the textures in the inventory state, so they don't get set for the other states. Set the textures in both states, or set them in the defaults tag so it gets set for all states.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Posted
9 hours ago, LeoCTH said:

.........

why you use forge blockstates?

vanilla blockstates are enough to handle it

Because the vanilla blockstate format looks like this:

 

"stateA=1,stateB=1,stateC=1,stateD=1" : { ... }
"stateA=1,stateB=1,stateC=1,stateD=2" : { ... }
"stateA=1,stateB=1,stateC=2,stateD=1" : { ... }
"stateA=1,stateB=1,stateC=2,stateD=2" : { ... }
... //11 nearly identical lines skipped
"stateA=2,stateB=2,stateC=2,stateC=2" : { ... }

And the forge blockstate format looks like this:

"stateA" : { "1" : { ... }, "2" : { ... } }
"stateB" : { "1" : { ... }, "2" : { ... } }
"stateC" : { "1" : { ... }, "2" : { ... } }
"stateD" : { "1" : { ... }, "2" : { ... } }

Which would you rather write?

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
7 hours ago, Draco18s said:

Because the vanilla blockstate format looks like this:

 


"stateA=1,stateB=1,stateC=1,stateD=1" : { ... }
"stateA=1,stateB=1,stateC=1,stateD=2" : { ... }
"stateA=1,stateB=1,stateC=2,stateD=1" : { ... }
"stateA=1,stateB=1,stateC=2,stateD=2" : { ... }
... //11 nearly identical lines skipped
"stateA=2,stateB=2,stateC=2,stateC=2" : { ... }

And the forge blockstate format looks like this:


"stateA" : { "1" : { ... }, "2" : { ... } }
"stateB" : { "1" : { ... }, "2" : { ... } }
"stateC" : { "1" : { ... }, "2" : { ... } }
"stateD" : { "1" : { ... }, "2" : { ... } }

Which would you rather write?

......

Still, when you make something like multifacing blocks then you should use forge.

but if you could use vanilla blockstate JSONs then WHY you'll need more complicated forge ones? (Like when handling VERY simple blocks)

 

Quote from Forge Docs:

Quote

You don’t have to use Forge’s blockstate format at all, you can also use the vanilla format!

lol?

Posted
1 hour ago, LeoCTH said:

but if you could use vanilla blockstate JSONs then WHY you'll need more complicated forge ones?

Which one of those two samples that I posted was more complicated?

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)
27 minutes ago, Draco18s said:

Which one of those two samples that I posted was more complicated?

I mean the “forge_marker”s, all of the

 "defaults": {
    "model": "cube_all",
    "transform": "forge:default-block"
  },
  "variants": {
    "inventory": [
      {
        "textures": {
          "all": "tekklands:blocks/tekknium_infused_diamond_ore"
        }
      }
    ],
    "normal": [
      {
        "textures": {
          "all": "tekklands:blocks/tekknium_infused_diamond_ore"
        }
      }
    ]
  }

-ish stuff...

as the docs said: "You can also use vanilla format!"

why shall we use forge blockstate JSONs?

Edited by LeoCTH
grammar
Posted
8 minutes ago, LeoCTH said:

I mean the “forge_marker”s, all of the

[...]

-ish stuff...

You know how much of what you posted was Forge format specific?

 

None of 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
1 minute ago, Draco18s said:

You know how much of what you posted was Forge format specific?

 

None of it.

I mean, why I NEEDS TO AND MUST TO use forge?

why NOT vanilla?

Posted
30 minutes ago, LeoCTH said:

I mean, why I NEEDS TO AND MUST TO use forge?

why NOT vanilla?

YOU DON'T HAVE TO. NO ONE SAID YOU DID.

YOUR the one who started asking about Forge blockstates.

And this isn't even your thread!

 

The whole reason the Forge format exists is to simplify complex state mappings (two or more different values) as Forge will do the cartesian grid for you (so you a) don't have to type out 366 lines of JSON and b) don't have to sort them alphabetically and get it wrong by fucking up and adding a space where one shouldn't be).

  • Like 1

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
Just now, Draco18s said:

YOU DON'T HAVE TO. NO ONE SAID YOU DID.

YOUR the one who started asking about Forge blockstates.

And this isn't even your thread!

 

The whole reason the Forge format exists is to simplify complex state mappings (two or more different values) as Forge will do the cartesian grid for you (so you a) don't have to type out 366 lines of JSON and b) don't have to sort them alphabetically and get it wrong by fucking up and adding a space where one shouldn't be).

I'm just asking HIM, the POSTER of the thread and at least two people INTERRUPTED me and the POSTER don't even speak ANYTHING.

I apologize for replying someone frequently in other's thread, but WHY I'm asking someone else and you guy wanna join into it?

And why the heck are you kinda pissed off and spit it at me?

 

Again, I'm asking the one who have the problem.

 

PS. Are you misunderstanding me as "I have the problem"? no, not at all. I can figure out myself while I'm doing THIS level of things.

PPS. You and that largs guy are NOT the ones I'm asking. Need to tell you again?

Posted (edited)

Ok, things done. I quit this thread.

If the owner of this thread want to tell me, it's his opinion.

 

Again, I don't have that problem AT ALL when I'm creating a very very super duper easy placeholder-leveled block.

Edited by LeoCTH
specific someone

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.