Jump to content

My custom crop texture doesn't show


ParanormalRyno

Recommended Posts

Hi

 

I have updated my mod to forge 7.1.1:650 but the crop textures no show if i remove the files from the texture folder is show in the folder i can not find them and when i add them back still no luck.

 

Here is my crop class:

 

 

package com.paranormalryno.lazyminer.block;

 

import java.util.Random;

 

import net.minecraft.block.Block;

import net.minecraft.client.renderer.texture.IconRegister;

import net.minecraft.creativetab.CreativeTabs;

import net.minecraft.util.Icon;

import net.minecraft.util.MathHelper;

import net.minecraft.world.World;

 

import com.paranormalryno.lazyminer.lib.ItemIds;

import com.paranormalryno.lazyminer.lib.Reference;

 

import cpw.mods.fml.relauncher.Side;

import cpw.mods.fml.relauncher.SideOnly;

 

public class BlockCoalCrop extends BlockLMCrop {

    @SideOnly(Side.CLIENT)

    private Icon[] iconArray;

 

public BlockCoalCrop(int par1) {

super(par1);

      this.setTickRandomly(true);

      float var3 = 0.5F;

      this.setBlockBounds(0.5F - var3, 0.0F, 0.5F - var3, 0.5F + var3, 0.25F, 0.5F + var3);

      this.setCreativeTab((CreativeTabs)null);

      this.setHardness(0.0F);

      this.setStepSound(soundGrassFootstep);

      this.disableStats();

}

 

  /**

    * Gets passed in the blockID of the block below and supposed to return true if its allowed to grow on the type of

    * blockID passed in. Args: blockID

    */

  protected boolean canThisPlantGrowOnThisBlockID(int par1)

  {

      return par1 == Block.tilledField.blockID;

  }

 

  /**

    * Ticks the block if it's been scheduled

    */

  @Override

  public void updateTick (World world, int x, int y, int z, Random random){

      if (world.getBlockMetadata(x, y, z) == 1){

          return;

      }

 

      if (random.nextInt(isFertile(world, x, y - 1, z) ? 75 : 100) != 0){

          return;

      }

 

      world.setBlockMetadataWithNotify(x, y, z, 1, 2);

  }

 

  /**

    * Apply bonemeal to the crops.

    */

  public void fertilize(World par1World, int par2, int par3, int par4)

  {

      int l = par1World.getBlockMetadata(par2, par3, par4) + MathHelper.getRandomIntegerInRange(par1World.rand, 2, 5);

 

      if (l > 7)

      {

          l = 7;

      }

 

      par1World.setBlockMetadataWithNotify(par2, par3, par4, l, 2);

  }

 

  @SideOnly(Side.CLIENT)

  /**

    * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata

    */

  public Icon getBlockTextureFromSideAndMetadata(int par1, int par2) {

      if (par2 < 0 || par2 > 7)

      {

          par2 = 7;

      }

 

      return this.iconArray[par2];

  }

 

  /**

    * The type of render function that is called for this block

    */

  public int getRenderType()

  {

      return 1;

  }

 

  /**

    * Generate a seed ItemStack for this crop.

    */

  protected int getSeedItem()

  {

      return ItemIds.COAL_SEEDS;

  }

 

  /**

    * Generate a crop produce ItemStack for this crop.

    */

  protected int getCropItem()

  {

      return ItemIds.COAL_BUD;

  }

 

  /**

    * Drops the block items with a specified chance of dropping the specified items

    */

  public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7)

  {

      super.dropBlockAsItemWithChance(par1World, par2, par3, par4, par5, par6, 0);

  }

 

  /**

    * Returns the ID of the items to drop on destruction.

    */

  public int idDropped(int par1, Random par2Random, int par3)

  {

      return par1 == 7 ? this.getCropItem() : this.getSeedItem();

  }

 

  /**

    * Returns the quantity of items to drop on block destruction.

    */

  public int quantityDropped(Random par1Random)

  {

      return 3;

  }

 

  @SideOnly(Side.CLIENT)

 

  /**

    * only called by clickMiddleMouseButton , and passed to inventory.setCurrentItem (along with isCreative)

    */

  public int idPicked(World par1World, int par2, int par3, int par4)

  {

      return this.getSeedItem();

  }

 

  @SideOnly(Side.CLIENT)

  public void func_94332_a(IconRegister par1IconRegister) {

      this.iconArray = new Icon[8];

 

      for (int i = 0; i < 7; ++i) {

          this.iconArray = par1IconRegister.registerIcon(Reference.MOD_ID.toLowerCase() + ":" + "lmcrop_" + i);

      }

 

      for (int i = 0; i > 7;) {

      this.iconArray[8] = par1IconRegister.registerIcon(Reference.MOD_ID.toLowerCase() + ":" + "lmcrop_" + "coal");

      }

  }

}

 

 

Link to comment
Share on other sites

After some messing around with the code it looks like this part of the code isn't working with i

 

 

for (int i = 0; i < 7; ++i) {

          this.iconArray = par1IconRegister.registerIcon(Reference.MOD_ID.toLowerCase() + ":" + "lmcrop_" + i);

 

 

 

Here is the updated code:

 

 

package com.paranormalryno.lazyminer.block;

 

import java.util.Random;

 

import net.minecraft.block.Block;

import net.minecraft.client.renderer.texture.IconRegister;

import net.minecraft.creativetab.CreativeTabs;

import net.minecraft.util.Icon;

import net.minecraft.util.MathHelper;

import net.minecraft.world.World;

 

import com.paranormalryno.lazyminer.lib.ItemIds;

import com.paranormalryno.lazyminer.lib.Reference;

 

import cpw.mods.fml.relauncher.Side;

import cpw.mods.fml.relauncher.SideOnly;

 

public class BlockCoalCrop extends BlockLMCrop {

    @SideOnly(Side.CLIENT)

    private Icon[] iconArray;

 

public BlockCoalCrop(int par1) {

super(par1);

      this.setTickRandomly(true);

      float var3 = 0.5F;

      this.setBlockBounds(0.5F - var3, 0.0F, 0.5F - var3, 0.5F + var3, 0.25F, 0.5F + var3);

      this.setCreativeTab((CreativeTabs)null);

      this.setHardness(0.0F);

      this.setStepSound(soundGrassFootstep);

      this.disableStats();

}

 

  /**

    * Gets passed in the blockID of the block below and supposed to return true if its allowed to grow on the type of

    * blockID passed in. Args: blockID

    */

  protected boolean canThisPlantGrowOnThisBlockID(int par1)

  {

      return par1 == Block.tilledField.blockID;

  }

 

  /**

    * Ticks the block if it's been scheduled

    */

  @Override

  public void updateTick (World world, int x, int y, int z, Random random){

      if (world.getBlockMetadata(x, y, z) == 1){

          return;

      }

 

      if (random.nextInt(isFertile(world, x, y - 1, z) ? 75 : 100) != 0){

          return;

      }

 

      world.setBlockMetadataWithNotify(x, y, z, 1, 2);

  }

 

  /**

    * Apply bonemeal to the crops.

    */

  public void fertilize(World par1World, int par2, int par3, int par4)

  {

      int l = par1World.getBlockMetadata(par2, par3, par4) + MathHelper.getRandomIntegerInRange(par1World.rand, 2, 5);

 

      if (l > 7)

      {

          l = 7;

      }

 

      par1World.setBlockMetadataWithNotify(par2, par3, par4, l, 2);

  }

 

  @SideOnly(Side.CLIENT)

  /**

    * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata

    */

  public Icon getBlockTextureFromSideAndMetadata(int par1, int par2) {

      if (par2 < 0 || par2 > 7)

      {

          par2 = 7;

      }

 

      return this.iconArray[par2];

  }

 

  /**

    * The type of render function that is called for this block

    */

  public int getRenderType()

  {

      return 1;

  }

 

  /**

    * Generate a seed ItemStack for this crop.

    */

  protected int getSeedItem()

  {

      return ItemIds.COAL_SEEDS;

  }

 

  /**

    * Generate a crop produce ItemStack for this crop.

    */

  protected int getCropItem()

  {

      return ItemIds.COAL_BUD;

  }

 

  /**

    * Drops the block items with a specified chance of dropping the specified items

    */

  public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7)

  {

      super.dropBlockAsItemWithChance(par1World, par2, par3, par4, par5, par6, 0);

  }

 

  /**

    * Returns the ID of the items to drop on destruction.

    */

  public int idDropped(int par1, Random par2Random, int par3)

  {

      return par1 == 7 ? this.getCropItem() : this.getSeedItem();

  }

 

  /**

    * Returns the quantity of items to drop on block destruction.

    */

  public int quantityDropped(Random par1Random)

  {

      return 3;

  }

 

  @SideOnly(Side.CLIENT)

 

  /**

    * only called by clickMiddleMouseButton , and passed to inventory.setCurrentItem (along with isCreative)

    */

  public int idPicked(World par1World, int par2, int par3, int par4)

  {

      return this.getSeedItem();

  }

 

  @Override

  @SideOnly(Side.CLIENT)

  public void registerIcons(IconRegister par1IconRegister) {

     

      this.iconArray = new Icon[8];

 

      for (int i = 0; i < 7; ++i) {

          this.iconArray = par1IconRegister.registerIcon(Reference.MOD_ID.toLowerCase() + ":" + "lmcrop_" + i);

      }

 

      for (int i = 0; i > 7;) {

      this.iconArray[8] = par1IconRegister.registerIcon(Reference.MOD_ID.toLowerCase() + ":" + "lmcrop_" + "coal");

      }

  }

}

 

 

Link to comment
Share on other sites

You need to add the @Override to all methods you intend to override. You fixed one signature, but getBlockTextureFromSideAndMetadata still does not exist in the superclass so your attempt to override does nothing. Thats what @Override would show you.

 

Thank you for all your help I didn't notice the getBlockTextureFromSideAndMetadata function was changed.

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



×
×
  • Create New...

Important Information

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