Jump to content

Recommended Posts

Posted

When I enter the creative tab the game crashes.

 

CrashReport

  Reveal hidden contents

 

 

 

 

package com.rnh.Yummy.Trees.Logs;

import java.util.List;

import com.rnh.Yummy.Yummy;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.BlockLog;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;

public class Log extends BlockLog{

public static final String[] logs = new String[] { "Apple", "banana"};

@SideOnly(Side.CLIENT)
public void getSubBlocks(Item item, CreativeTabs tabs, List list){
	 for (int i = 0; i < logs.length; i++) {
    	   list.add(new ItemStack( item ,1 ,i));
       }
}
@SideOnly(Side.CLIENT)
public void registerBLockIcons ( IIconRegister icon){
	this.field_150167_a = new IIcon[logs.length];
	this.field_150166_b = new IIcon[logs.length];

	for (int i = 0; i < this.field_150167_a.length; i++){
		this.field_150167_a[i] =icon.registerIcon(Yummy.MODID + this.getTextureName() + logs[i]);
		this.field_150166_b[i] =icon.registerIcon(Yummy.MODID + this.getTextureName() + logs[i] + "top");

	}
}
}


and heres my ItemBlock Class

package com.rnh.Yummy.ItemBlocks;

import net.minecraft.block.Block;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;

public class ItemLogBlocks extends ItemBlock {

public static final String[] logs = new String[]{"Apple","Banana"};

public ItemLogBlocks(Block block) {
	super(block);
	this.setHasSubtypes(true);


}
public String getUnlocalizedName(ItemStack itemstack) {
int i = itemstack.getItemDamage();
if ( i < 0 || i >= logs.length){
	i = 0;
}
return super.getUnlocalizedName() + "." + logs[i];
}
public int getMetadata (int meta){
return meta;
}
}

 

I would really appreciate is someone explained what went wrong here, and taught me the right way to do it.

Please forgive me if I seem incompetent. I'm still learning.

 

Thank you. <3

Posted

I was following a tutorial and I understand the content of it I'm just getting different results then shown.

I'm trying to learn what it does, the best way I know is by trial and error. I can only figure out so much by myself, so that's why I ask questions like this.

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.