Jump to content

[1.7.2] Block isn't working... (Solved!)


arie2002

Recommended Posts

Hi!

 

I'm currently modding with forge 1.7.2, and my items already look pretty good ;D, but I have one problem: ZE BLOCKS :o

My block is just like obsidian, you can only mine it with a diamond pick. :)

Minecraft renders the block as an 3d item, but when I mine it and pickup the ItemBlock item, it is rendering in 2d? :o

And when I right click with the item my game crashes... ???

What am I doing wrong? :o

 

Main mod code:

 

package com.heroworkbrine.mominecraft;

 

//Imports

 

@Mod(modid = MoMinecraft.MODID, version = MoMinecraft.VERSION)

public class MoMinecraft {

 

public static final String MODID = "mominecraft";

public static final String VERSION = "0.01";

 

@Instance(value = "Mo'Minecraft")

public static MoMinecraft instance;

 

@SidedProxy(clientSide = "com.heroworkbrine.mominecraft.proxy.ProxyClient", serverSide = "com.heroworkbrine.mominecraft.proxy.ProxyCommon")

public static ProxyCommon proxy;

 

//ITEM

public static final Item ironRod = new ItemIronRod();

public static final Item diamondRod = new ItemDiamondRod();

 

//BLOCK

public static final Block brokenObsidianBlock = new BlockBrokenObsidian();

public static final Item brokenObsidianItem = new ItemBlock(brokenObsidianBlock);

 

@EventHandler

public void preInit(FMLPreInitializationEvent event) {

//ITEM

GameRegistry.registerItem(ironRod, ironRod.getUnlocalizedName());

GameRegistry.registerItem(diamondRod, diamondRod.getUnlocalizedName());

 

//BLOCKS

GameRegistry.registerBlock(brokenObsidianBlock, "tile.BrokenObsidian");

 

//CRAFTING RECIPE

GameRegistry.addShapedRecipe(new ItemStack(ironRod, 4), "X", "X", 'X', Items.iron_ingot);

GameRegistry.addShapedRecipe(new ItemStack(diamondRod, 4), "X", "X", 'X', Items.diamond);

}

 

@EventHandler

public void load(FMLInitializationEvent event) {

proxy.registerRenderers();

}

 

@EventHandler

public void postInit(FMLPostInitializationEvent event) {

 

}

 

}

 

 

 

BlockBrokenObsidian code:

 

package com.heroworkbrine.mominecraft.block;

 

//Imports

 

import com.heroworkbrine.mominecraft.MoMinecraft;

 

public class BlockBrokenObsidian extends Block {

 

public BlockBrokenObsidian() {

super(Material.field_151576_e); //Material: Stone

this.func_149711_c(25F); //Hardness

this.func_149752_b(1000F); //Resistance

this.func_149672_a(field_149780_i); //Sound: Stone

this.func_149663_c("BrokenObsidian"); //Unlocalized Name

this.func_149658_d(MoMinecraft.MODID + ":tile.BrokenObsidian"); //Texture Path

this.setHarvestLevel("pickaxe", 3);

}

 

        /**

*  Item dropped when broken

*/

public Item func_149650_a(int p_149650_1_, Random p_149650_2_, int p_149650_3_) {

return MoMinecraft.brokenObsidianItem;

}

 

}

 

 

I never post on the forums, but when I do, I have no clue how to do a certain thing.

Link to comment
Share on other sites

The problem with the Block class is, that forge didn't rename all the func_ functions yet.

I did found these functions that might do what you say:

this.func_149649_H();

this.func_149722_s();

I'll try it!

 

EDIT:

Both didn't work

I never post on the forums, but when I do, I have no clue how to do a certain thing.

Link to comment
Share on other sites

Hi

 

re rendering - this link might be helpful - the sections on block and item rendering in particular.

http://greyminecraftcoder.blogspot.com.au/p/list-of-topics.html

http://greyminecraftcoder.blogspot.com.au/2013/08/rendering-inventory-items.html

 

They are written for 1.6.4 but if you hunt through the vanilla code corresponding to RenderItem.renderItemAndEffectIntoGUI, you should be able to find out pretty easily how it works in 1.7.2. 

 

Kukipett might be on the right track with the ItemBlock.  In 1.6.4, registering a Block automatically created an associated ItemBlock, and the default rendering for ItemBlocks is 3D.  Perhaps 1.7.2 is subtly different.

 

-TGG

Link to comment
Share on other sites

As there is no ID anymore when you harvest a block you need to call an Item not an ID, and this Item has to be registered or you don't get anything

For example, for each Block myblock you need to have an  ItemBlock myblock.

Okay! I'll try that!

But do you have to register the ItemBlock as well?

And should the block be in the Creative tab or should the Item be in the Creative tab?

I never post on the forums, but when I do, I have no clue how to do a certain thing.

Link to comment
Share on other sites

The problem is now a bit different.

 

The solution is now a bit different too.  You just have to make a change in your code and it will be fine.

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.

Link to comment
Share on other sites

The problem is now a bit different.

 

The solution is now a bit different too.  You just have to make a change in your code and it will be fine.

Like I don't know that.

But I don't know what the problem is, neither how to fix it!

Can you push me in the right direction? Like what the problem is?

I never post on the forums, but when I do, I have no clue how to do a certain thing.

Link to comment
Share on other sites

Can you push me in the right direction? Like what the problem is?

 

I can't without current code and current description of the problem.  "It changed" is not a description.  It's useless information that requires me to activate my psychic powers and the government hates it when I go rogue.

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.

Link to comment
Share on other sites

The problem is now a bit different.

 

The solution is now a bit different too.  You just have to make a change in your code and it will be fine.

Like I don't know that.

But I don't know what the problem is, neither how to fix it!

Can you push me in the right direction? Like what the problem is?

 

Well, we can't help you if you don't tell us how your problem changed.

I think you should use 1.6.4 if you are new to modding with forge.

Just few mods have already updated , and most players won't use 1.7 if their favourite mods aren't ready.

Here could be your advertisement!

Link to comment
Share on other sites

I think you should use 1.6.4 if you are new to modding with forge.

Just few mods have updated by, and most players won't use 1.7 if their favourite mods aren't ready.

 

This.  I'm not even using 1.7 yet as the deobfuscation process is not even yet to the point when I started modding.  And there were still common-use func_* calls.  1.7 not only has that problem, but a "everything is different now and the experienced modders are having trouble in places."

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.

Link to comment
Share on other sites

I can't without current code and current description of the problem.  "It changed" is not a description.  It's useless information that requires me to activate my psychic powers and the government hates it when I go rogue.

Well, we can't help you if you don't tell us how your problem changed.

When I said that the problem changed, I edited the main topic post.

Why doesn't anyone check the main topic post these days!

I think you should use 1.6.4 if you are new to modding with forge.

Just few mods have already updated , and most players won't use 1.7 if their favourite mods aren't ready.

I'm not new at modding, everything just changed with the blocks

I never post on the forums, but when I do, I have no clue how to do a certain thing.

Link to comment
Share on other sites

When I said that the problem changed, I edited the main topic post.

Why doesn't anyone check the main topic post these days!

 

1) You didn't say you updated the main post

2) I cannot assume that you updated the main post

 

Now, I don't know anything about 1.7.2, but I'd try removing this:

 

   public Item func_149650_a(int p_149650_1_, Random p_149650_2_, int p_149650_3_) {
      return MoMinecraft.brokenObsidianItem;
   }

 

Seems to me that vanilla code should be handling that...

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.

Link to comment
Share on other sites

for a simple block you only need on file the class the block is made from and then just register it right. which you seem to not be doing.

 

no need for this weird itemBlcok garbage.

 

  GameRegistry.registerBlock(brokenObsidianBlock, MODID + (brokenObsidianBlock.func_149739_a().substring(5)));

Link to comment
Share on other sites

for a simple block you only need on file the class the block is made from and then just register it right. which you seem to not be doing.

 

no need for this weird itemBlcok garbage.

 

GameRegistry.registerBlock(brokenObsidianBlock, MODID + (brokenObsidianBlock.func_149739_a().substring(5)));

Thank you! It is working now

I never post on the forums, but when I do, I have no clue how to do a certain thing.

Link to comment
Share on other sites

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

    • OLXTOTO - Bandar Togel Online Dan Slot Terbesar Di Indonesia OLXTOTO telah lama dikenal sebagai salah satu bandar online terkemuka di Indonesia, terutama dalam pasar togel dan slot. Dengan reputasi yang solid dan pengalaman bertahun-tahun, OLXTOTO menawarkan platform yang aman dan andal bagi para penggemar perjudian daring. DAFTAR OLXTOTO DISINI DAFTAR OLXTOTO DISINI DAFTAR OLXTOTO DISINI Beragam Permainan Togel Sebagai bandar online terbesar di Indonesia, OLXTOTO menawarkan berbagai macam permainan togel. Mulai dari togel Singapura, togel Hongkong, hingga togel Sidney, pemain memiliki banyak pilihan untuk mencoba keberuntungan mereka. Dengan sistem yang transparan dan hasil yang adil, OLXTOTO memastikan bahwa setiap taruhan diproses dengan cepat dan tanpa keadaan. Slot Online Berkualitas Selain togel, OLXTOTO juga menawarkan berbagai permainan slot online yang menarik. Dari slot klasik hingga slot video modern, pemain dapat menemukan berbagai opsi permainan yang sesuai dengan preferensi mereka. Dengan grafis yang memukau dan fitur bonus yang menggiurkan, pengalaman bermain slot di OLXTOTO tidak akan pernah membosankan. Keamanan dan Kepuasan Pelanggan Terjamin Keamanan dan kepuasan pelanggan merupakan prioritas utama di OLXTOTO. Mereka menggunakan teknologi enkripsi terbaru untuk melindungi data pribadi dan keuangan para pemain. Tim dukungan pelanggan yang ramah dan responsif siap membantu pemain dengan setiap pertanyaan atau masalah yang mereka hadapi. Promosi dan Bonus Menarik OLXTOTO sering menawarkan promosi dan bonus menarik kepada para pemainnya. Mulai dari bonus selamat datang hingga bonus deposit, pemain memiliki kesempatan untuk meningkatkan kemenangan mereka dengan memanfaatkan berbagai penawaran yang tersedia. Penutup Dengan reputasi yang solid, beragam permainan berkualitas, dan komitmen terhadap keamanan dan kepuasan pelanggan, OLXTOTO tetap menjadi salah satu pilihan utama bagi para pecinta judi online di Indonesia. Jika Anda mencari pengalaman berjudi yang menyenangkan dan terpercaya, OLXTOTO layak dipertimbangkan.
    • I have been having a problem with minecraft forge. Any version. Everytime I try to launch it it always comes back with error code 1. I have tried launching from curseforge, from the minecraft launcher. I have also tried resetting my computer to see if that would help. It works on my other computer but that one is too old to run it properly. I have tried with and without mods aswell. Fabric works, optifine works, and MultiMC works aswell but i want to use forge. If you can help with this issue please DM on discord my # is Haole_Dawg#6676
    • Add the latest.log (logs-folder) with sites like https://paste.ee/ and paste the link to it here  
    • I have no idea how a UI mod crashed a whole world but HUGE props to you man, just saved me +2 months of progress!  
    • So i know for a fact this has been asked before but Render stuff troubles me a little and i didnt find any answer for recent version. I have a custom nausea effect. Currently i add both my nausea effect and the vanilla one for the effect. But the problem is that when I open the inventory, both are listed, while I'd only want mine to show up (both in the inv and on the GUI)   I've arrived to the GameRender (on joined/net/minecraft/client) and also found shaders on client-extra/assets/minecraft/shaders/post and client-extra/assets/minecraft/shaders/program but I'm lost. I understand that its like a regular screen, where I'd render stuff "over" the game depending on data on the server, but If someone could point to the right client and server classes that i can read to see how i can manage this or any tip would be apreciated
  • Topics

×
×
  • Create New...

Important Information

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