Jump to content

Connected Textures


Mtshaw113

Recommended Posts

Im trying to make this glass block(That im going to make later today, also dont know how to make blocks transparent(yes I need a lot of help on stuff)) have connected texture but I cant find any tutorials that I could follow(yes im a noob, but I like to do things my way, not the professional way, yet) And I also need to update to 1.6 but I dont know how. I read somewhere that you need to make sure you backed up your code, then delete it all and do it again but with the current versions but I dont know. Any help would be greatly appreciated!

Link to comment
Share on other sites

this is probarly where you need to put your code in for connected textures

public Icon getBlockTexture(IBlockAccess world, int x, int y, int z, int  side){}

return the corresponding icon based on the other blocks around it.

 

as for the transparency goes...

take a look in the BlockIce class.

it shouldnt be hard to find the method you need in there.

 

and update just like you update your other mods from earlier versions.

except you now need to put your textures in the assets folder instead of your mods folder.

the forge team has made it a hell of a lot easier to install your mod eviroment.

just download the forge source, hit install, wait till the installation is finished and your good to go.

 

then you only need to put your source code in the new src folder change update your classes and everything should be ready.

Link to comment
Share on other sites

Im trying to make this glass block(That im going to make later today, also dont know how to make blocks transparent(yes I need a lot of help on stuff)) have connected texture but I cant find any tutorials that I could follow(yes im a noob, but I like to do things my way, not the professional way, yet) And I also need to update to 1.6 but I dont know how. I read somewhere that you need to make sure you backed up your code, then delete it all and do it again but with the current versions but I dont know. Any help would be greatly appreciated!

 

package f1rSt1k.blocks;

import java.util.List;
import java.util.Random;

import f1rSt1k.Main;

import net.minecraft.block.Block;
import net.minecraft.block.BlockGlass;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Icon;
import net.minecraft.world.IBlockAccess;

public class BlockDecorativeGlass extends BlockGlass 
{

public static boolean connectedTexture = true;

public static Icon[] textures = new Icon[47];

public static int[] textureRefByID = { 0, 0, 6, 6, 0, 0, 6, 6, 3, 3, 19, 15, 3, 3, 19, 15, 1, 1, 18, 18, 1, 1,
                                       13, 13, 2, 2, 23, 31, 2, 2, 27, 14, 0, 0, 6, 6, 0, 0, 6, 6, 3, 3, 19,
                                       15, 3, 3, 19, 15, 1, 1, 18, 18, 1, 1, 13, 13, 2, 2, 23, 31, 2, 2, 27,
                                       14, 4, 4, 5, 5, 4, 4, 5, 5, 17, 17, 22, 26, 17, 17, 22, 26, 16, 16, 20,
                                       20, 16, 16, 28, 28, 21, 21, 46, 42, 21, 21, 43, 38, 4, 4, 5, 5, 4, 4,
                                       5, 5, 9, 9, 30, 12, 9, 9, 30, 12, 16, 16, 20, 20, 16, 16, 28, 28, 25,
                                       25, 45, 37, 25, 25, 40, 32, 0, 0, 6, 6, 0, 0, 6, 6, 3, 3, 19, 15, 3, 3,
                                       19, 15, 1, 1, 18, 18, 1, 1, 13, 13, 2, 2, 23, 31, 2, 2, 27, 14, 0, 0,
                                       6, 6, 0, 0, 6, 6, 3, 3, 19, 15, 3, 3, 19, 15, 1, 1, 18, 18, 1, 1, 13,
                                       13, 2, 2, 23, 31, 2, 2, 27, 14, 4, 4, 5, 5, 4, 4, 5, 5, 17, 17, 22, 26,
                                       17, 17, 22, 26, 7, 7, 24, 24, 7, 7, 10, 10, 29, 29, 44, 41, 29, 29, 39,
                                       33, 4, 4, 5, 5, 4, 4, 5, 5, 9, 9, 30, 12, 9, 9, 30, 12, 7, 7, 24, 24,
                                       7, 7, 10, 10, 8, 8, 36, 35, 8, 8, 34, 11 };

public BlockDecorativeGlass()
{
         super(502, Material.glass, false);
         setHardness(0.6F);
         setResistance(2.0F);
         setCreativeTab(Main.f1rSt1kCraftCreativeTab);
         setStepSound(soundGlassFootstep);
}

public int idDropped(int par1, Random par2Random, int par3)
{
    return Item.stick.itemID;
}

public int quantityDropped(Random par1Random)
{
    return 1 + par1Random.nextInt(4);
}



public void registerIcons(IconRegister iconRegistry)
{
         for (int i = 0; i < 47; i++) textures[i] = iconRegistry.registerIcon("f1rst1kcraft:woodGlass_" + (i+1));
}

public Icon getBlockTexture(IBlockAccess world, int x, int y, int z, int side)
{
    
	if(connectedTexture){

	boolean[] bitMatrix = new boolean[8];
        
         if (side == 0 || side == 1)
         {
                 bitMatrix[0] = world.getBlockId(x-1, y, z-1) == this.blockID;
                 bitMatrix[1] = world.getBlockId(x, y, z-1) == this.blockID;
                 bitMatrix[2] = world.getBlockId(x+1, y, z-1) == this.blockID;
                 bitMatrix[3] = world.getBlockId(x-1, y, z) == this.blockID;
                 bitMatrix[4] = world.getBlockId(x+1, y, z) == this.blockID;
                 bitMatrix[5] = world.getBlockId(x-1, y, z+1) == this.blockID;
                 bitMatrix[6] = world.getBlockId(x, y, z+1) == this.blockID;
                 bitMatrix[7] = world.getBlockId(x+1, y, z+1) == this.blockID;
         }
         if (side == 2 || side == 3)
         {
                 bitMatrix[0] = world.getBlockId(x+(side==2?1:-1), y+1, z) == this.blockID;
                 bitMatrix[1] = world.getBlockId(x, y+1, z)                      == this.blockID;
                 bitMatrix[2] = world.getBlockId(x+(side==3?1:-1), y+1, z) == this.blockID;
                 bitMatrix[3] = world.getBlockId(x+(side==2?1:-1), y, z) == this.blockID;
                 bitMatrix[4] = world.getBlockId(x+(side==3?1:-1), y, z) == this.blockID;
                 bitMatrix[5] = world.getBlockId(x+(side==2?1:-1), y-1, z) == this.blockID;
                 bitMatrix[6] = world.getBlockId(x, y-1, z)                      == this.blockID;
                 bitMatrix[7] = world.getBlockId(x+(side==3?1:-1), y-1, z) == this.blockID;
         }
         if (side == 4 || side == 5)
         {
                 bitMatrix[0] = world.getBlockId(x, y+1, z+(side==5?1:-1)) == this.blockID;
                 bitMatrix[1] = world.getBlockId(x, y+1, z)                      == this.blockID;
                 bitMatrix[2] = world.getBlockId(x, y+1, z+(side==4?1:-1)) == this.blockID;
                 bitMatrix[3] = world.getBlockId(x, y, z+(side==5?1:-1)) == this.blockID;
                 bitMatrix[4] = world.getBlockId(x, y, z+(side==4?1:-1)) == this.blockID;
                 bitMatrix[5] = world.getBlockId(x, y-1, z+(side==5?1:-1)) == this.blockID;
                 bitMatrix[6] = world.getBlockId(x, y-1, z)                      == this.blockID;
                 bitMatrix[7] = world.getBlockId(x, y-1, z+(side==4?1:-1)) == this.blockID;
         }
        
         int idBuilder = 0;

         for (int i = 0; i <= 7; i++) idBuilder = idBuilder + (bitMatrix[i]?(i==0?1:(i==1?2:(i==2?4:(i==3?8:(i==4?16:(i==5?32:(i==6?64:128))))))):0);
        
         return idBuilder>255||idBuilder<0?textures[0]:textures[textureRefByID[idBuilder]];
         
	}
	return textures[0];
}

public Icon getIcon(int side, int meta)
{
         return textures[0];
}
}

 

Link to comment
Share on other sites

this is probarly where you need to put your code in for connected textures

public Icon getBlockTexture(IBlockAccess world, int x, int y, int z, int  side){}

return the corresponding icon based on the other blocks around it.

 

as for the transparency goes...

take a look in the BlockIce class.

it shouldnt be hard to find the method you need in there.

 

and update just like you update your other mods from earlier versions.

except you now need to put your textures in the assets folder instead of your mods folder.

the forge team has made it a hell of a lot easier to install your mod eviroment.

just download the forge source, hit install, wait till the installation is finished and your good to go.

 

then you only need to put your source code in the new src folder change update your classes and everything should be ready.

Can you give me more detail on how to update? I have MCP running, and I believe Forge installed correctly, but when I go into eclipse and I go into the explorer I cant find any Forge directories. And I also dont know where to put my source from 1.5.2

Link to comment
Share on other sites

Basically all I need is a detailed tutorial(pictures would help a lot) on how to update(including fixing textures, that helps too), because I apparently messed up somewhere

Edit: Ok so I got it all working, except my textures. Pink and Black squares, just like I think everyone :D

Link to comment
Share on other sites

there is like a million threads asking about textures for 1.6.X

opening any of them would reveal that nothing has change code wise for blocks if you use registerIcons.

blockIcon = iconregister.registerIcon(modid+":texturename");

 

the location for textures are now

/assets/modid/textures/blocks/textureName.png

 

 

If you guys dont get it.. then well ya.. try harder...

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.