Posted April 18, 201411 yr I have this package hat.blocks.palmblocks; import javax.swing.Icon; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import hat.HAT; 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 palmlog extends Block{ private static String textureName; @SideOnly(Side.CLIENT) private Icon topTexture; public palmlog(String textureName){ super(Material.wood); setHardness(1F); setResistance(1.0F); this.textureName = textureName; } @SideOnly(Side.CLIENT) public void registerIcons(IconRegister reg){ this.blockIcon = reg.registerIcon(HAT.MODID + ":" + textureName); this.topTexture = reg.registerIcon(HAT.MODID + ":" + textureName + "_Top"); } @SideOnly(Side.CLIENT) public Icon getIcon(int side, int meta){ if(side == 0 || side == 1){ return this.topTexture; } return this.blockIcon; } } red=errors also in the main file palmlog = new palmlog("Palm_Wood_Log").setBlockName("palmlog").setCreativeTab(hatblocksTab); GameRegistry.registerBlock(palmlog, "palmlog");
April 18, 201411 yr Your setting textureName to null.. so it is returning null. Give it a location here: palmlog = new palmlog(null).setBlockName("palmlog").setCreativeTab(hatblocksTab); GameRegistry.registerBlock(palmlog, "palmlog"); That null, needs to be a texture name.
April 18, 201411 yr Author i know sorry i forgot to update that part but the errors in the block class still exsist
April 18, 201411 yr Hi Dude, if you're getting an error it would probably help a lot if you tell us what the error message actually is :-) I guess the cause is probably this import javax.swing.Icon; Wrong import... -TGG
April 18, 201411 yr Author Hi Dude, if you're getting an error it would probably help a lot if you tell us what the error message actually is :-) I guess the cause is probably this import javax.swing.Icon; Wrong import... -TGG there is no error message it's in eclipse which found and underlined the errors, and I'll check my imports tomorrow
April 18, 201411 yr Hi I use IntelliJ not Eclipse, but I'm sure it's the same: - if I hover the mouse near the red underline, it tells me the error message. Also, if I perform a compile, it brings up an error message in the compilation log. Give it a go and see? -TGG
April 19, 201411 yr Also in 1.7.x aren't they called IIcon and IIconRegister? You even imported the right classes, just missed the I in front of the names in your methods. Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! | mah twitter This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.
April 19, 201411 yr Author ok i now have this copied from the normal log as it uses a rotated pillar block package hat.blocks.palmblocks; import javax.swing.Icon; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import hat.HAT; import net.minecraft.block.Block; import net.minecraft.block.BlockRotatedPillar; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.util.IIcon; public class palmlog extends BlockRotatedPillar{ @SideOnly(Side.CLIENT) public IIcon[] field_150167_a; @SideOnly(Side.CLIENT) public IIcon[] field_150166_b; private static final String __OBFID = "CL_00000266"; // sideicon = Palm_Wood_Log_Side; public palmlog() { super(Material.wood); this.setHardness(2.0F); this.setStepSound(soundTypeWood); } @SideOnly(Side.CLIENT) protected IIcon getSideIcon(int p_150163_1_) { return this.field_150167_a[p_150163_1_ % this.field_150167_a.length]; } @SideOnly(Side.CLIENT) protected IIcon getTopIcon(int p_150161_1_) { return this.field_150166_b[p_150161_1_ % this.field_150166_b.length]; } } or this package hat.blocks.palmblocks; import javax.swing.Icon; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import hat.HAT; import net.minecraft.block.Block; import net.minecraft.block.BlockRotatedPillar; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.util.IIcon; public class palmlog extends BlockRotatedPillar{ private static String textureName; @SideOnly(Side.CLIENT) private IIcon topTexture; public palmlog(String textureName){ super(Material.wood); setHardness(2.0F); setResistance(1.0F); setStepSound(soundTypeWood); this.textureName = textureName; } @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister reg){ this.blockIcon = reg.registerIcon(HAT.MODID + ":" + textureName + "_Side.png"); this.topTexture = reg.registerIcon(HAT.MODID + ":" + textureName + "_Top.png"); } @SideOnly(Side.CLIENT) public IIcon getIcon(int side){ if(side == 0 || side == 1){ return this.topTexture; } return this.blockIcon; } @Override protected IIcon getSideIcon(int var1) { return null; }} Im aware that the if statement corrosponding to sides as in the one above doesnt work for a rotated pillar block, which is why i have a version with the copied code, i can't get textures to load in the world, the fields i pressume link to the texture name it's trying to pull but i dont know how to register these to pull my textures instead?
April 19, 201411 yr Can you show your main class (where you initialize / register your block)? Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! | mah twitter This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.
April 19, 201411 yr Author yup there you go package hat; import hat.blocks.dyeblocks.dyeblock1; import hat.blocks.dyeblocks.dyeblock10; import hat.blocks.dyeblocks.dyeblock11; import hat.blocks.dyeblocks.dyeblock12; import hat.blocks.dyeblocks.dyeblock13; import hat.blocks.dyeblocks.dyeblock14; import hat.blocks.dyeblocks.dyeblock15; import hat.blocks.dyeblocks.dyeblock16; import hat.blocks.dyeblocks.dyeblock2; import hat.blocks.dyeblocks.dyeblock3; import hat.blocks.dyeblocks.dyeblock4; import hat.blocks.dyeblocks.dyeblock5; import hat.blocks.dyeblocks.dyeblock6; import hat.blocks.dyeblocks.dyeblock7; import hat.blocks.dyeblocks.dyeblock8; import hat.blocks.dyeblocks.dyeblock9; import hat.blocks.palmblocks.palmlog; import hat.blocks.palmblocks.palmplank; import net.minecraft.block.Block; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.SidedProxy; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.registry.GameRegistry; @Mod(modid = HAT.MODID, version = HAT.VERSION) public class HAT { public static final String MODID = "hat"; public static final String VERSION = "1.0"; @SidedProxy(clientSide = "hat.ClientProxy", serverSide = "hat.CommonProxy") public static CommonProxy proxy; public static Block palmlog; @EventHandler public void preInit(FMLPreInitializationEvent event){ //Palm Settings palmlog = new palmlog().setBlockName("palmlog").setCreativeTab(hatblocksTab); GameRegistry.registerBlock(palmlog, "palmlog"); }
April 19, 201411 yr Author or package hat; import hat.blocks.dyeblocks.dyeblock1; import hat.blocks.dyeblocks.dyeblock10; import hat.blocks.dyeblocks.dyeblock11; import hat.blocks.dyeblocks.dyeblock12; import hat.blocks.dyeblocks.dyeblock13; import hat.blocks.dyeblocks.dyeblock14; import hat.blocks.dyeblocks.dyeblock15; import hat.blocks.dyeblocks.dyeblock16; import hat.blocks.dyeblocks.dyeblock2; import hat.blocks.dyeblocks.dyeblock3; import hat.blocks.dyeblocks.dyeblock4; import hat.blocks.dyeblocks.dyeblock5; import hat.blocks.dyeblocks.dyeblock6; import hat.blocks.dyeblocks.dyeblock7; import hat.blocks.dyeblocks.dyeblock8; import hat.blocks.dyeblocks.dyeblock9; import hat.blocks.palmblocks.palmlog; import hat.blocks.palmblocks.palmplank; import net.minecraft.block.Block; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.SidedProxy; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.registry.GameRegistry; @Mod(modid = HAT.MODID, version = HAT.VERSION) public class HAT { public static final String MODID = "hat"; public static final String VERSION = "1.0"; @SidedProxy(clientSide = "hat.ClientProxy", serverSide = "hat.CommonProxy") public static CommonProxy proxy; public static Block palmlog; @EventHandler public void preInit(FMLPreInitializationEvent event){ //Palm Settings palmlog = new palmlog("Palm_Wood_Log").setBlockName("palmlog").setCreativeTab(hatblocksTab); GameRegistry.registerBlock(palmlog, "palmlog"); }
April 20, 201411 yr Author also im creating view recipes for vanilla things such as beds and turning wool back into string, but only know how to do this for white wool, how can it be set to use all the colours? as i pressume if ||=or then 'new ItemStack(Blocks.wool, 1) || new Itemstack(Blocks.wool, 1, 1)' would work if i did for all 16 but is there a way to pull in one go
April 20, 201411 yr Author C:\Users\User\Desktop\MC MODDING\HAT\src\main\resources\assets\hat\textures\blocks then the textures are called "Palm_Wood_Log_Top" and "Palm_Wood_Log_Side"
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.