Jump to content

[1.7.2] Block not appearing in CreativeTabs.tabBlock


Recommended Posts

Posted

I'm working in 1.7.2 forge right now. I am currently running 1027 and can not seem to get a block to appear in the game.

 

I've followed several different tutorials and have not been able to get any of them to work. The ones for 1.6.4 were a little off but usually had some follow up text to change to 1.7.2.

 

Currently I have it in CreativeTabs.tabFood because the list is shorter, but I have not been able to get it to appear in any tab. There is not a single error in the start up output (except something about an rt.jar or something) and there is no problems until I try to find it in the creative inventory or use /give player 500 1, which in theory should give me my block. I get a red message saying "No item with id 500" or something similar.

 

I have managed to get an item to appear in the food tab without a single problem using almost identical code.

 

This code is in the preinitialization event:

Block testblock = new TestBlock();
Block.blockRegistry.addObject(500, "testblock", testblock);

 

This class extends net.minecraft.block.Block:

public TestBlock() {
    super(Material.ground);
    setCreativeTab(CreativeTabs.tabFood);
    setBlockTextureName("testmod:BlockTut");
}

Posted

Why don't you remake your block.

 

public static Block testBlock;

@EventHandler
public void preInit(FMLPreInitializationEvent event) {
testBlock = new Block(//stuff).setUnlocalizedName("testBlock");
}

ids? ...

Posted

@EventHandler
public void preInit(FMLPreInitializationEvent event)
{
	testBlock = new BlockStone().setBlockName("testblock").setBlockTextureName("testmod:BlockTut");
	Block.blockRegistry.addObject(500, "testblock", testBlock);

	Item testitem = new TestItem();
	Item.itemRegistry.addObject(501, "testitem", testitem);
}

 

In 1.7 there is no setUnlocalizedName method (at least that I saw...) There is a setBlockName which I'm assuming is the same thing as the previous method. The id (as far as I can tell should be registering at 500.

Posted

Are mods not meant to use the GameRegistry or at least GameData to register blocks and items in a manner that lets Minecract/Forge/FML worry about the id's?

 

Also I think it might need to be in the FMLPreInitializationEvent event now, I am not sure if it works fully in the other 2 events?

Posted

Apparently to get it to show up inside the creative inventory you need an ItemBlock instance instead of just having a "Block".

 

I have no idea what the difference is between GameData.itemRegistry and Item.itemRegistry or any other variables. I honestly have no idea if forge manages the item ids or not. This is my first day tinkering with forge and it's got an interesting learning curve if you start on 1.7.2 - things are way different than the tutorials say.

 

testBlock = new BlockStone().setBlockName("testblock").setBlockTextureName("testmod:BlockTut");
GameData.blockRegistry.add(500, "testblock", testBlock);

ItemBlock itemBlock = (ItemBlock) new ItemBlock(testBlock).setUnlocalizedName("testBlock").setCreativeTab(CreativeTabs.tabBlock).setTextureName("testmod:BlockTut");
GameData.itemRegistry.add(502, "testblockitem", itemBlock);

Posted

This is all I needed along with the textures/blocks/tutorial_block.png and lang/en_US.lang file:

@Mod(modid = ExampleMod.MODID, name=ExampleMod.NAME, version = ExampleMod.VERSION)
public class ExampleMod
{
    public static final String MODID = "examplemod";
    public static final String NAME = "An example mod";
    public static final String VERSION = "1.0";
    
    public static Block tutorialBlock;
    
    @EventHandler
    public void preinit(FMLPreInitializationEvent event)
    {

        tutorialBlock = new TutorialBlock(Material.rock);
        tutorialBlock.setBlockName("tutorialBlock").setCreativeTab(CreativeTabs.tabMisc).setStepSound(Block.soundTypeStone).setBlockTextureName(MODID+":tutorial_block");
        GameRegistry.registerBlock(tutorialBlock,"tutorialBlock");

 

The block class is a simple subclass of Block that calls the super-constructor.

And it just works. The block shows up in the creative tab, I can place and break it, and it looks pretty.

 

More code to be added when I think of what I want it to do.

Posted

Alrighty. Looked at your post:

 

What version of 1.7.2 are you using? This method seems to have been renamed in my Block.class. Did it return the "unlocalized name"? If you tell me what it's purpose was I can track it down.

brokenObsidianBlock.func_149739_a()

 

Thanks for the response.

 

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

    • Title: Understanding ASM, Coremods, and Why Some Mods Break on Refactoring Post text: Hey everyone! I’ve been learning Minecraft modding for a while and ran into a question that I can’t figure out on my own. Hoping someone more experienced can help or give me some guidance. Here’s my issue: With most “normal” Forge mods — for example, those that just add new blocks or items — it’s fairly straightforward to refactor them. I can rename packages, move classes around, or reorganize the project without too much trouble. But as soon as I look at more complex cheat-style mods that use ASM, coremods, or deep game hooks — like Xray or Entity Xray — even a simple refactor breaks everything. For instance, just renaming classes or changing the package structure is enough to stop these kinds of mods from working at all. My question is: What’s fundamentally different about the architecture of these kinds of mods that makes them so fragile when refactoring? Is it the way they use bytecode manipulation, classloading tricks, or mappings that ties them to their original structure? And how can I better understand these kinds of mods so that I can reorganize or refactor them without breaking the core functionality? I’d really appreciate any insights into ASM, coremods, or classloaders — or any guides/resources that could help me understand this better. If you’ve successfully refactored or dissected mods like Xray or Entity Xray before, I’d love to hear your thoughts! Thanks in advance for any advice — I’m looking to deepen my understanding of these kinds of mods. ✌️
    • I can't figure out if you're looking for help trying to steal someone elses work, or cheat at the game....
    • Title: Why Is It So Hard to Rename and Restructure Mods Like Xray or AntiXray? 🤔 Post text: Hey everyone! I’ve been digging into Minecraft modding for a while and have one big question that I can’t figure out on my own. Maybe someone with more experience could help or give me some advice. Here’s the issue: When I take a “normal” Minecraft mod — for example, one that just adds some blocks or new items — I can easily change its structure, package names, or even rebrand it entirely. It’s straightforward. But as soon as I try this with cheat-type mods like XrayMod or AntiXray, everything falls apart. Even if I just rename the classes, refactor the packages, or hide its identity somehow, the mod either breaks or stops working properly. XrayMod in particular is proving to be a nightmare to modify without losing its core function. So my question is — why is this so much harder with cheat mods like Xray? Is there something fundamentally different about how they’re coded, loaded, or protected that prevents simple renaming or restructuring? And if so, how can I actually learn to understand someone else’s cheat mod enough to safely refactor it without breaking the core features? I’ve already been spending over two months trying to figure this out and haven’t gotten anywhere. It feels like there must be some trick or knowledge I’m missing. Would really appreciate any thoughts, tips, or references — maybe there are guides or techniques for understanding cheat-mod internals? Or if you’ve successfully “disguised” a cheat mod like Xray before, I’d love to hear how you did it. Thanks in advance for any help or discussion. ✌️
    • just started making cinamatic contect check it out on my channel or check out my facebook page    Humbug City Minecraft Youtube https://www.youtube.com/watch?v=v2N6OveKwno https://www.facebook.com/profile.php?id=61575866982337  
    • Where did you get the schematic? Source/Link? And do use an own modpack or a pre-configured from curseforge? If yes, which one On a later time, I can make some tests on my own - but I need the schematic and the modpack name
  • Topics

×
×
  • Create New...

Important Information

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