public final class BlockRenderRegister {
public static void registerBlockRenderer() {
Minecraft.getMinecraft().getRenderItem().getItemModelMesher()
.register(Item.getItemFromBlock(BlockHandler.list.get(0)), 0, new ModelResourceLocation(RefStrings.modId+":"+"reinforcedStone1".substring(5), "inventory"));
}
}
@Mod(modid = RefStrings.modId, name = RefStrings.modName, version = RefStrings.modVer)
public class MainRegistry {
@SidedProxy(clientSide = "com.eclipsed.proxy.ClientProxy", serverSide = "com.eclipsed.proxy.ServerProxy")
public static ServerProxy proxy;
@Mod.Instance(RefStrings.modId)
public static MainRegistry instance;
@EventHandler
public void PreLoad(FMLPreInitializationEvent PreEv) {
}
@EventHandler
public void load(FMLInitializationEvent LoadEv) {
BlockHandler.mainRegistry();
proxy.registerRenderInfo(); // this is where it calls BlockRenderRegister.registerBlockRenderer();
CraftingManager.mainRegistry();
}
@EventHandler
public void PostLoad(FMLPostInitializationEvent PostEv) {
}
@EventHandler
public void serverLoad(FMLServerStartingEvent ServerEv) {
}
}
I've tried for hours and I can't figure out why the textures are not working! Can someone please help me figure this out?
Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(BlockHandler.list.get(0)), 0, new ModelResourceLocation(RefStrings.modId+":"+"reinforcedStone1".substring(5), "inventory"));
Try removing .substring(5).
Rollback Post to RevisionRollBack
I got a mod...go check it out. Its got guns and hats and other stuff.
Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(BlockHandler.list.get(0)), 0, new ModelResourceLocation(RefStrings.modId+":"+"reinforcedStone1".substring(5), "inventory"));
Try removing .substring(5).
I removed it but it didn't work
In some tutorials they say you need to use .substring(5), but I have no idea why. It doesn't make sense.
The .substring(5) returns part of the String starting at 5. Using "reinforcedStone1".substring(5) as an example: r=0, e=1, i=2, n=3, f=4, o=5, ect. It will return the String starting at 5 or o, so "orcedStone1".
What did you name the block when you registered it using GameRegistry.registerBlock(block, "name")? If you named it "tile.reinforcedStone1" change the name to "reinforcedStone1". The "tile." is already added by the Block class. Also change the name of your texture to "reinforcedStone1" if it is not already that. Again, leave out the .substring(5) in your BlockRenderRegister.
Note: When naming your block in the lang file it should be tile.unlocalizedName.name=Reinforced Stone 1. unlocalizedName should be found in the same place as registerBlock.
Example of how I set it: setUnlocalizedName(TF2Reference.MODID + "_" + name);
My MODID is "alex_teamfortress2v2", name is the name of the block in this case "reinforcedStone1". The unlocalizedName would be "alex_teamfortress2v2_reinforcedStone1".
In the lang file it would be "tile.alex_teamfortress2v2_reinforcedStone1.name=Reinforced Stone 1". (No parentheses.)
Rollback Post to RevisionRollBack
I got a mod...go check it out. Its got guns and hats and other stuff.
The block.getUnlocalizedName() returns "tile.reinforcedStone1". You are registering the block as "tile.reinforcedStone1" instead of "reinforcedStone1". Add .substring(5) to block.getUnlocalizedName() so it only returns "reinforcedStone1".
I am new to coding in 1.8, so I am trying to make a simple mod of reinforced cobblestone
The block gets created properly, but I can't get the textures to load (on the ground or in the inventory)
[09:22:51] [Client thread/ERROR] [FML]: Model definition for location eclipserc:tile.reinforcedStone1#inventory not found
[09:22:51] [Client thread/ERROR] [FML]: Model definition for location eclipserc:tile.reinforcedStone1#normal not found
My directory tree:
src/main/resources/assets/eclipserc
--blockstates
--lang
--models
----block
----item
--textures
----blocks
assets/eclipserc/blockstates/reinforcedStone1.json
{
"variants": {
"normal": { "model": "eclipserc:reinforcedStone1" }
}
}
assets/eclipserc/models/block/reinforcedStone1.json
{
"parent": "block/cube_all",
"textures": {
"all": "eclipserc:blocks/reinforcedStone1"
}
}
assets/eclipserc/models/item/reinforcedStone1.json
{
"parent": "eclipserc:block/reinforcedStone1",
"display": {
"thirdperson": {
"rotation": [ 10, -45, 170 ],
"translation": [ 0, 1.5, -2.75 ],
"scale": [ 0.375, 0.375, 0.375 ]
}
}
}
BlockRenderRegister.java
package com.eclipsed.render;
import com.eclipsed.RefStrings;
import com.eclipsed.block.BlockHandler;
import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.item.Item;
public final class BlockRenderRegister {
public static void registerBlockRenderer() {
Minecraft.getMinecraft().getRenderItem().getItemModelMesher()
.register(Item.getItemFromBlock(BlockHandler.list.get(0)), 0, new ModelResourceLocation(RefStrings.modId+":"+"reinforcedStone1".substring(5), "inventory"));
}
}
MainRegistry.java
package com.eclipsed;
import com.eclipsed.block.BlockHandler;
import com.eclipsed.proxy.ServerProxy;
import com.eclipsed.render.BlockRenderRegister;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.SidedProxy;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
@Mod(modid = RefStrings.modId, name = RefStrings.modName, version = RefStrings.modVer)
public class MainRegistry {
@SidedProxy(clientSide = "com.eclipsed.proxy.ClientProxy", serverSide = "com.eclipsed.proxy.ServerProxy")
public static ServerProxy proxy;
@Mod.Instance(RefStrings.modId)
public static MainRegistry instance;
@EventHandler
public void PreLoad(FMLPreInitializationEvent PreEv) {
}
@EventHandler
public void load(FMLInitializationEvent LoadEv) {
BlockHandler.mainRegistry();
proxy.registerRenderInfo(); // this is where it calls BlockRenderRegister.registerBlockRenderer();
CraftingManager.mainRegistry();
}
@EventHandler
public void PostLoad(FMLPostInitializationEvent PostEv) {
}
@EventHandler
public void serverLoad(FMLServerStartingEvent ServerEv) {
}
}
I've tried for hours and I can't figure out why the textures are not working! Can someone please help me figure this out?
In BlockRenderRegister
Try removing .substring(5).
I got a mod...go check it out. Its got guns and hats and other stuff.
http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/1291464-1-8-1-7-10-team-fortress-2-mod-v2-0-0-v1-8-6
I removed it but it didn't work
In some tutorials they say you need to use .substring(5), but I have no idea why. It doesn't make sense.
The .substring(5) returns part of the String starting at 5. Using "reinforcedStone1".substring(5) as an example: r=0, e=1, i=2, n=3, f=4, o=5, ect. It will return the String starting at 5 or o, so "orcedStone1".
What did you name the block when you registered it using GameRegistry.registerBlock(block, "name")? If you named it "tile.reinforcedStone1" change the name to "reinforcedStone1". The "tile." is already added by the Block class. Also change the name of your texture to "reinforcedStone1" if it is not already that. Again, leave out the .substring(5) in your BlockRenderRegister.
Note: When naming your block in the lang file it should be tile.unlocalizedName.name=Reinforced Stone 1. unlocalizedName should be found in the same place as registerBlock.
Example of how I set it: setUnlocalizedName(TF2Reference.MODID + "_" + name);
My MODID is "alex_teamfortress2v2", name is the name of the block in this case "reinforcedStone1". The unlocalizedName would be "alex_teamfortress2v2_reinforcedStone1".
In the lang file it would be "tile.alex_teamfortress2v2_reinforcedStone1.name=Reinforced Stone 1". (No parentheses.)
I got a mod...go check it out. Its got guns and hats and other stuff.
http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/1291464-1-8-1-7-10-team-fortress-2-mod-v2-0-0-v1-8-6
The lang file works properly, there's no problem with it.
The unlocalized name is set to "reinforcedStone1" in the ReinforcedStone class
Code for registering the block is: GameRegistry.registerBlock(block, block.getUnlocalizedName());
My texture is the same as minecraft cobblestone and is in src/main/resources/assets/eclipserc/textures/blocks and is called "reinforcedStone1.png"
The only thing that is not working is getting the textures to render. Creating the block and everything else is fine.
GameRegistry.registerBlock(block, block.getUnlocalizedName());
The block.getUnlocalizedName() returns "tile.reinforcedStone1". You are registering the block as "tile.reinforcedStone1" instead of "reinforcedStone1". Add .substring(5) to block.getUnlocalizedName() so it only returns "reinforcedStone1".
What it should look like:
GameRegistry.registerBlock(block, block.getUnlocalizedName().substring(5));
I got a mod...go check it out. Its got guns and hats and other stuff.
http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/1291464-1-8-1-7-10-team-fortress-2-mod-v2-0-0-v1-8-6
IT WORKS!!! THANKS!
Get the tremendous gaming accessories to increase the fun in the game play.