MC Modding
Please register and join the community!


Join the forum, it's quick and easy

MC Modding
Please register and join the community!
MC Modding
Would you like to react to this message? Create an account in a few clicks or log in to continue.

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

4 posters

Go down

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

Post by austin56101 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";
   }
}
austin56101
austin56101
Moderator
Moderator

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

Back to top Go down

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

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

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

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

http://www.mcmodding.4umer.com

Back to top Go down

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

Post by lcass 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

https://www.youtube.com/user/thealcasgroup

Back to top Go down

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

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

Lol hmmmm idk? xD
austin56101
austin56101
Moderator
Moderator

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

Back to top Go down

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

Post by lcass 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

https://www.youtube.com/user/thealcasgroup

Back to top Go down

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

Post by msw1 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

Back to top Go down

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

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

Not sure
austin56101
austin56101
Moderator
Moderator

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

Back to top Go down

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

Post by Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

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