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.



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • If you’ve ever experienced the sinking feeling of losing funds online, you’re not alone. Enter recovery services like ADWARE RECOVERY SPECIALIST, the heroes of the digital age who help individuals track down and retrieve lost funds. These services act as modern-day sheriffs in the Wild West of the internet, bringing justice to those who have fallen victim to online scams and fraud. In a world where online transactions are as common as selfies, the need for recovery services is more pressing than ever. Individuals worldwide are vulnerable to various online schemes, from investment fraud to phishing scams. Recovery services provide a glimmer of hope for those who have lost money, offering a chance to recover what's rightfully theirs and restore faith in the digital realm. The beauty of recovery services like ADWARE RECOVERY SPECIALIST lies in their global reach. Email: Adwarerecoveryspecialist@auctioneer. net  Regardless of where individuals are located worldwide, these services extend their virtual arms to help victims of online fraud. From bustling metropolises to remote villages, no corner of the world is beyond the grasp of these modern-day Robin Hoods. Thanks to the wonders of globalization, recovery services have transcended geographical boundaries to serve individuals worldwide. The interconnected nature of the digital world means that help is just a click away, bridging gaps between nations and bringing relief to those in need. In a world where borders are becoming increasingly blurred, recovery services stand as beacons of accessibility and assistance. When a broker stole from me and withheld access from me for five months, I had no idea that I would be able to recover my trading money back. I'm relieved that I was able to get my money returned without any issues. The impact of recovery services like ADWARE RECOVERY SPECIALIST extends far beyond individual wallets. Communities worldwide have experienced a renewed sense of trust and security, knowing that there are dedicated professionals working tirelessly to recover their lost assets. These services not only bring financial relief but also restore faith in the integrity of the digital world. Trust is the cornerstone of any successful recovery service, and building credibility in a global market can pose unique challenges. ADWARE RECOVERY SPECIALIST strives to maintain transparency and reliability in all its interactions, earning the trust of clients worldwide. ADWARE RECOVERY SPECIALIST can be talked to through:  Website: www.adwarerecoveryspecialist.expert  Telegram: @ADWARE_RECOVERY_SPECIALIST
    • The game wont start and keeps crashing everytime I hit play "The game crashed whilst rendering overlay Error: java.lang.IllegalAccessError: failed to access class com.mojang.blaze3d.platform.GlStateManager$TextureState from class net.coderbot.iris.gl.IrisRenderSystem$DSAARB (com.mojang.blaze3d.platform.GlStateManager$TextureState is in module minecraft@1.18.2 of loader 'TRANSFORMER' @724b939e; net.coderbot.iris.gl.IrisRenderSystem$DSAARB is in module oculus@1.6.4 of loader 'TRANSFORMER' @724b939e)" How do I get it to stop? Log error here: https://pastebin.com/byv1dR54
    • In case anyone happens on this with the same issue, I was able to overcome it. After re-reading @Paint_Ninja's last post numerous time, it finally dawned on me that he was referring wholly to the forge installer, which has nothing to do with the packaged modpack installer. As such, I downloaded the new copy of the forge installer and copied it to my linux host, then opened a second ssh session and prepared a cp command to move the new (correct) installer over to the install directory where I was installing the modpack. After the modpack installer had just about finished retrieving files, I overwrote the installer.jar file with the correct one in a seperate ssh session. The modpack (packaged) installer then used that jar to install forge with the included files, and the install finished as I would have expected. Thanks all!
    • Just tried it again removed directory entirely, downloaded a brand new, fresh copy and did a fresh install, even going as far as running as root for the install to make sure I didn't hose something up permissions wise (I know its a terrible idea.), but same thing, failed install. This is making me feel mighty dumb, I must say... any help anyone could provide would be greatly appreciated.
  • Topics

×
×
  • Create New...

Important Information

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