Quick question about modding

midgetassin

New Member
Jul 29, 2019
197
0
0
Ok this is going to be a very dumb question but do you have to code a item and then the block. For example
If you want to add a table do you have to go throught the whole itemTable then go through blockTable
 

SatanicSanta

New Member
Jul 29, 2019
4,849
-3
0
Short answer: No.
Long answer: No, unless you also need it to have item functions that blocks cannot do.
 

midgetassin

New Member
Jul 29, 2019
197
0
0
Short answer: No.
Long answer: No, unless you also need it to have item functions that blocks cannot do.

If you cant tell I'm new to moding and have taken on a huge project for the first mod to be done. So thank you for replying to me so quickly so i could get back to it. I probally will be asking more questions later in this tread but real quick if its not to much of a hassel what kind of things would items be able to do that blocks can't
 

midgetassin

New Member
Jul 29, 2019
197
0
0
Thank you a ton agin but looks like i have to restart my mod agin everything i have done is gone (yes i was saving) after my power just flickered for some reason
 

midgetassin

New Member
Jul 29, 2019
197
0
0
Srry to bother you guys agin but I need help getting my textures to show up in game. I'm fellowing Mr.Crayfishes tutorial and did wht he said but it still didn't show up.

This is the line of code im useing is there something wrong with it .setTextureName("XY:itemBlackXychoriditeShard"

Edit: its also not showing that there is any errors
 

SatanicSanta

New Member
Jul 29, 2019
4,849
-3
0
Srry to bother you guys agin but I need help getting my textures to show up in game. I'm fellowing Mr.Crayfishes tutorial and did wht he said but it still didn't show up.

This is the line of code im useing is there something wrong with it .setTextureName("XY:itemBlackXychoriditeShard"

Edit: its also not showing that there is any errors
Uh, there's no closing parentheses.
 

SatanicSanta

New Member
Jul 29, 2019
4,849
-3
0
Do you have a repository or something that I can look at? That one snippet isn't really enough for me to help.
 

InfinityRaider

New Member
Jul 29, 2019
1,169
-1
1
Override this method in your block class
Code:
@Override@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister reg) {
this.blockIcon = reg.registerIcon(this.getUnlocalizedName().substring(this.getUnlocalizedName().indexOf('.') + 1));
}

Use this to register your block
Code:
public static void registerBlock(Block block,String name) {
block.setBlockName(<modid>.toLowerCase()+':'+name);
GameRegistry.registerBlock(block, name);
}

The texture should then go in the assets/<modid>/textures/blocks folder, with the name you specified when registering the block: <name>.png

EDIT: if it's an item, just do the analogous, but for items.
 

SatanicSanta

New Member
Jul 29, 2019
4,849
-3
0
Override this method in your block class
Code:
@Override@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister reg) {
this.blockIcon = reg.registerIcon(this.getUnlocalizedName().substring(this.getUnlocalizedName().indexOf('.') + 1));
}

Use this to register your block
Code:
public static void registerBlock(Block block,String name) {
block.setBlockName(<modid>.toLowerCase()+':'+name);
GameRegistry.registerBlock(block, name);
}

The texture should then go in the assets/<modid>/textures/blocks folder, with the name you specified when registering the block: <name>.png

EDIT: if it's an item, just do the analogous, but for items.
This is so overly complicated.

To register blocks I do:
Code:
GameRegistry.registerBlock(blockName, blockName);

And for textures, in the block's constructor:
Code:
this.setBlockTextureName("modid:texture_name");
 
  • Like
Reactions: midgetassin

midgetassin

New Member
Jul 29, 2019
197
0
0
This is so overly complicated.

To register blocks I do:
Code:
GameRegistry.registerBlock(blockName, blockName);

And for textures, in the block's constructor:
Code:
this.setBlockTextureName("modid:texture_name");
I'm doing it the same way as you
 

midgetassin

New Member
Jul 29, 2019
197
0
0
I couldnt figure out how to do the repository so wil this work
package midgetassin.ProjectXy;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.item.Item;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.registry.GameRegistry;

@Mod(modid = "XY", name = "Project XY", version = "1.0")
public class ProjectXY {

public static Item itemBlueXychoriditeShard;
public static Item itemRedXychoriditeShard;
public static Item itemGreenXychoriditeShard;
public static Item itemWhiteXychoriditeShard;
public static Item itemBlackXychoriditeShard;
public static Block blockBlueXychoriditeStone;

@EventHandler
public void preIint(FMLPreInitializationEvent event){
//Item/block init and registering, config handling
itemBlueXychoriditeShard = new ItemBlueXychoriditeShard().setUnlocalizedName("ItemBlueXychoriditeShard").setTextureName("XY:itemBlueXychoriditeShard");
GameRegistry.registerItem(itemBlueXychoriditeShard, itemBlueXychoriditeShard.getUnlocalizedName().substring(5));

itemRedXychoriditeShard = new ItemRedXychoriditeShard().setUnlocalizedName("ItemRedXychoriditeShard").setTextureName("XY:itemRedXychoriditeShard");
GameRegistry.registerItem(itemRedXychoriditeShard, itemRedXychoriditeShard.getUnlocalizedName().substring(5));

itemGreenXychoriditeShard = new ItemGreenXychoridite().setUnlocalizedName("ItemGreenXychoriditeShard").setTextureName("XY:itemGreenXychoriditeShard");
GameRegistry.registerItem(itemGreenXychoriditeShard, itemGreenXychoriditeShard.getUnlocalizedName().substring(5));

itemWhiteXychoriditeShard = new ItemWhiteXychoridite().setUnlocalizedName("ItemWhiteXychoriditeShard").setTextureName("XY:itemWhiteXychoriditeShard");
GameRegistry.registerItem(itemWhiteXychoriditeShard, itemWhiteXychoriditeShard.getUnlocalizedName().substring(5));

itemBlackXychoriditeShard = new ItemBlackXychoridite().setUnlocalizedName("ItemBlackXychoriditeshard").setTextureName("XY:itemBlackXychoriditeShard");
GameRegistry.registerItem(itemBlackXychoriditeShard, itemBlackXychoriditeShard.getUnlocalizedName().substring(5));

blockBlueXychoriditeStone = new BlockBlueXychoriditeStone(Material.ground).setBlockName("BlockBlueXychoriditeStone");
GameRegistry.registerBlock(blockBlueXychoriditeStone, blockBlueXychoriditeStone.getUnlocalizedName().substring(5));
}


@EventHandler
public void Init(FMLInitializationEvent event){
//Proxy, Tile entity, entity Gui and packet registry
}



@EventHandler
public void postInit(FMLPostInitializationEvent event){
//list of blocks add
}
}
 

VapourDrive

New Member
Jul 29, 2019
536
-8
1
Have you made sure your IDE has a refreshed resource folder? All of my assets get added after I make them in gimp so they don't show up in the project until after a refresh or restart. This has caused me many a heart-ache.