Jump to content

Icon not rendering


GodOfYeti

Recommended Posts

heres my code

 

package com.mcpixelplex.blocks;

import com.mcpixelplex.CreativeTabs.BlessedCreativeTab;
import com.mcpixelplex.lib.RefStrings;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.util.IIcon;

public class machineBlock extends Block{

public machineBlock(Material p_i45394_1_) {
	super(p_i45394_1_);
}

@SideOnly(Side.CLIENT)
public static IIcon topIcon;
@SideOnly(Side.CLIENT)
public static IIcon sideIcon;
@SideOnly(Side.CLIENT)
public static IIcon frontIcon;

@SideOnly(Side.CLIENT)
public void registerIIcons(IIconRegister icon) {
	topIcon = icon.registerIcon(RefStrings.MODID + ":machineBlockTop"); //top
	sideIcon = icon.registerIcon(RefStrings.MODID + ":machineBlockSide"); //side
	frontIcon = icon.registerIcon(RefStrings.MODID + ":machineBlockFront"); //front
}

public IIcon getIIcon(int side, int meta) {
if(side == 0 || side == 1) {
		return topIcon;
	} else if(side == 2) {
		return frontIcon;
	} else {
		return sideIcon;
	}
}

}

Link to comment
Share on other sites

This is why you use @Override

If you had @Override on your getIIcon function you would know what the problem is.

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

should

 

Or rather, it's common practice and considered good technique, but the compiler doesn't give a shit.

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

Yeah, common practice to make it easier to tell wether something is a class, method, or field.

 

Package, class, constant, methods.  Yep.

(packages are all lower case.  Classes are camel case with a capitalized first letter, constants are ALL CAPS, methods, fields, and other variables are camel case with lower case first letter).

 

Not to be rude but ya getting a little bit off topic, the getIIcon tells me to remove @override

 

Because your method signature is wrong.  It's not overriding any function in the super class.  Look closely.

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

Yeah, common practice to make it easier to tell wether something is a class, method, or field.

 

Package, class, constant, methods.  Yep.

(packages are all lower case.  Classes are camel case with a capitalized first letter, constants are ALL CAPS, methods, fields, and other variables are camel case with lower case first letter).

 

Not to be rude but ya getting a little bit off topic, the getIIcon tells me to remove @override

 

Because your method signature is wrong.  It's not overriding any function in the super class.  Look closely.

 

 

What can I do to fix it

Link to comment
Share on other sites

getIcon != getIIcon

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

This is what I got so far

 

package com.mcpixelplex.blocks;

import com.mcpixelplex.CreativeTabs.BlessedCreativeTab;
import com.mcpixelplex.lib.RefStrings;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;

public class MachineBlock extends Block{

public MachineBlock(int id) {
	super(Material.iron);
	setBlockName("machineBlock");
	setCreativeTab(BlessedCreativeTab.tabBlocks);
	setHardness(5F);
	setResistance(10F);
}

//public TileEntity createNewTileEntity(World world) {
//	return null;
//}

@SideOnly(Side.CLIENT)
public static IIcon topIcon;
@SideOnly(Side.CLIENT)
public static IIcon sideIcon;
@SideOnly(Side.CLIENT)
public static IIcon frontIcon;

@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister icon) {
	topIcon = icon.registerIcon(RefStrings.MODID + ":machineBlockTop"); //top
	sideIcon = icon.registerIcon(RefStrings.MODID + ":machineBlockSide"); //side
	frontIcon = icon.registerIcon(RefStrings.MODID + ":machineBlockFront"); //front
}

    @Override
public IIcon getIcon(int side, int meta) {
	if(side == 0 || side == 1) {
		return topIcon;
	} else if(side == 2) {
		return frontIcon;
	} else {
		return sideIcon;
	}
}

}

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.



×
×
  • Create New...

Important Information

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