MC Modding
Please register and join the community!

[1.8.1 Mod Creation] How to make Multi-Textured blocks!

View previous topic View next topic Go down

[1.8.1 Mod Creation] How to make Multi-Textured blocks!

Post by austin56101 on Tue Oct 25, 2011 2:41 am

ok this goes into ChargeBlock.java


Code:
package net.minecraft.src;
import java.util.Random;

public class ChargeBlock extends Block
{
    // Top texture will be the same for bottom.
    private int topTexture = ModLoader.addOverride( "/terrain.png", "/chargetop.png");
    private int sideTexture = ModLoader.addOverride( "/terrain.png", "/chargeside.png");
    private int frontOn = ModLoader.addOverride( "/terrain.png", "/chargefronton.png");
    private int FrontOff = ModLoader.addOverride( "/terrain.png", "/chargefrontoff.png");

    protected ChargeBlock(int i, int j)
    {
        super(i, j, Material.wood);
    }

    public int getBlockTextureFromSide(int i)
    {
        if(i == 0 || i == 1)                                  // 0 is the bottom texture, 1 is the top
            return topTexture;            // in theory, the ModLoader.addOverride will work here, but having separate variables for them is much neater.
        else
        if(i == 1 || i == 2)   
            return frontOn;
        else
      return sideTexture;
    }
}


This goes into mod_ChargeBlock:


Code:
package net.minecraft.src;
import java.util.Random;

public class mod_ChargeBlock extends BaseMod
{


   public static final Block chargeBlock = new ChargeBlock(197,0).setHardness(0.0F).setResistance(5.0F).setLightValue(1.0F).setBlockName("asdf");
   
 


   public mod_ChargeBlock()
   {   


      ModLoader.RegisterBlock(chargeBlock);
      ModLoader.AddName(chargeBlock, "chargeBlock");
      ModLoader.AddRecipe(new ItemStack(chargeBlock, 10), new Object[] {
         " * ", Character.valueOf('*'), Block.dirt
      });
   }

   public String Version()
   {
      return "1.8.1";
   }
}
avatar
austin56101
Moderator
Moderator

Posts : 85
Join date : 2011-10-22
Age : 20
Location : Cali!

View user profile

Back to top Go down

Re: [1.8.1 Mod Creation] How to make Multi-Textured blocks!

Post by Strengthowns on Tue Oct 25, 2011 8:46 am

Please, explain it. Don't just copy/paste.
avatar
Strengthowns
Admin

Posts : 79
Join date : 2011-06-14
Location : Right here!

View user profile http://www.mcmodding.4umer.com

Back to top Go down

Re: [1.8.1 Mod Creation] How to make Multi-Textured blocks!

Post by lcass on Thu Oct 27, 2011 2:22 pm

Its very simple really just read it don't post a comment without reading it full detail.
This how the furnace does it. What do you think private int toptextue means.

lcass
Member

Posts : 145
Join date : 2011-10-24
Location : england

View user profile http://www.youtube.com/user/thealcasgroup

Back to top Go down

Re: [1.8.1 Mod Creation] How to make Multi-Textured blocks!

Post by austin56101 on Thu Oct 27, 2011 4:23 pm

Lol hmmmm idk? xD
avatar
austin56101
Moderator
Moderator

Posts : 85
Join date : 2011-10-22
Age : 20
Location : Cali!

View user profile

Back to top Go down

Re: [1.8.1 Mod Creation] How to make Multi-Textured blocks!

Post by lcass on Thu Oct 27, 2011 4:52 pm

here austin the code is here for it I will send a link to it its more simple and you only need to put it into the namhere.class you then edit the textures it works the same as yours
Code:
 public int getBlockTexture(IBlockAccess iblockaccess, int i, int j, int k, int l)
    {
        if(l == 1)
        {
            return blockIndexInTexture + 17;
        }
        if(l == 0)
        {
            return blockIndexInTexture + 17;
        }
        int i1 = iblockaccess.getBlockMetadata(i, j, k);
        if(l != i1)
        {
            return blockIndexInTexture;
        }
        if(isActive)
        {
            return blockIndexInTexture + 16;
        } else
        {
            return blockIndexInTexture - 1;
        }
    }
and then I think you might need this
Code:
public int getBlockTextureFromSide(int i)
    {
        if(i == 1)
        {
            return blockIndexInTexture + 17;
        }
        if(i == 0)
        {
            return blockIndexInTexture + 17;
        }
        if(i == 3)
        {
            return blockIndexInTexture - 1;
        } else
        {
            return blockIndexInTexture;
        }
    }

lcass
Member

Posts : 145
Join date : 2011-10-24
Location : england

View user profile http://www.youtube.com/user/thealcasgroup

Back to top Go down

Re: [1.8.1 Mod Creation] How to make Multi-Textured blocks!

Post by msw1 on Wed Nov 02, 2011 12:20 am

How would I make this with MineForge? [Reading it from a spritesheet rather than a .addOverride]

msw1
Member

Posts : 8
Join date : 2011-11-01

View user profile

Back to top Go down

Re: [1.8.1 Mod Creation] How to make Multi-Textured blocks!

Post by austin56101 on Wed Nov 02, 2011 1:27 am

Not sure
avatar
austin56101
Moderator
Moderator

Posts : 85
Join date : 2011-10-22
Age : 20
Location : Cali!

View user profile

Back to top Go down

Re: [1.8.1 Mod Creation] How to make Multi-Textured blocks!

Post by Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum