Jump to content

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


Recommended Posts

Posted

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.

Posted

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.

Posted

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.

 

 

Posted

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

Posted

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.

Posted

I accedently removed my mod, so I had te remake it.

The problem is now a bit different.

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

Posted

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.

Posted

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.

Posted

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.

Posted

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!

Posted

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.

Posted

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.

Posted

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.

Posted

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)));

Posted

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.

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.