The operator != is undefined for the argument type(s) boolean, int

11,173

You have:

private boolean[] ctexture = new boolean[16];

Then you do:

if(this.ctexture[i] != 0)
        ↑              ↑
     boolean          int

In Java, you can't do that, 0 is an int, this.ctexture[i] is a boolean.

You should probably do:

if(this.ctexture[i]) //if true

You have invalid comparisons in other places too, please fix them as well

Share:
11,173
Admin
Author by

Admin

Updated on June 17, 2022

Comments

  • Admin
    Admin almost 2 years

    I keep getting the error The operator != is undefined for the argument type(s) boolean, int on my code and I have no idea on what to do to fix it. The error appears inside eclipse as well as on launch

    Some help would be greatly appreciated :) Thanks!

      private boolean[] ctexture = new boolean[16]; 
    
      public boolean[] flipTopBottom = new boolean[16];
    
          this.ctexture[id] = connectedTexture;
    
      @SideOnly(Side.CLIENT)
      public Icon getIcon(int par1, int par2)
      {
        if ((par1 <= 1) && (this.flipTopBottom[(par2 & 0xF)] != 0)  //The error occurs here// && ((this.icons[(par2 & 0xF)] instanceof IconConnectedTexture))) {
          return new IconConnectedTextureFlipped((IconConnectedTexture)this.icons[(par2 & 0xF)]);
        }
        return this.icons[(par2 & 0xF)];
      }
    
    
      @SideOnly(Side.CLIENT)
      public void registerIcons(IconRegister par1IconRegister)
      {
        for (int i = 0; i < 16; i++) {
          if ((this.texture[i] != null) && (this.texture[i] != "")) {
            if (this.ctexture[i] != 0) { //It also occurs here
              this.icons[i] = new IconConnectedTexture(par1IconRegister, this.texture[i]);
            } else {
              this.icons[i] = par1IconRegister.registerIcon(this.texture[i]);
            }
          }
    
  • Admin
    Admin over 10 years
    Okay, but if I set it to true, the icon shows, but the textures do not connect (That's the idea, for the textures to connect)
  • Admin
    Admin over 10 years
    would errors like this be caused from deobfuscating code? Because i was using this code from another project to learn more complex methods and using the original produces no errors in the game, only when looked at in eclipse
  • Maroun
    Maroun over 10 years
    @user3219869 Did that code contain the lines that caused the errors?
  • Admin
    Admin over 10 years
    if (this.ctexture[i] != 0) { <--- from the original obfuscated file
  • Maroun
    Maroun over 10 years
    @user3219869 That's wrong, unless ctexture is an array of ints there.
  • Admin
    Admin over 10 years
    unless im forgetting code somewhere, but i dont think i can be bothered sifting through hundreds of lines of code looking for something that may be missing. also the whole project runs perfectly fine, even along side my own
  • Admin
    Admin over 10 years
    holy god i am dumb, forgot to register the custom renderer under the client proxy.... :S Anyway It WORKS! finally after 1.5 days of tinkering