Jump to content

Recommended Posts

Posted

Im trying to have a lightvalue on a block meta, but its not going as well as i had hoped. The first block in the meta works well, but when i try to add a second block, the texture is really bright, like its got false light.

 

	
/*
 * @Override public int getLightValue (IBlockAccess world, int x, int y, int
 * z) { if (world.getBlockMetadata(x, y, z) == 0) { return lightValue[15]; }
 * return super.getLightValue(world, x, y, z); }
 */
/*
 * @Override public int getLightValue(IBlockAccess iba, int x, int y, int z)
 * { int meta = iba.getBlockMetadata(x, y, z); if (meta == 0) { return 15; }
 * if (meta == 1) { return 0; } return 0; }
 */
@Override
public int getLightValue(IBlockAccess world, int x, int y, int z) {
	if (world.getBlockMetadata(x, y, z) == 0) {
		return 15;
	} else {
		return 0;
	}
}

 

the /* */ areas is old previous attempts, they all turn out like this.

h1hFVaj.png

 

 

The bricks are the block im refering to, if i place something on it, fence, wall, lever etc, it turns dark like its supposed to, i tryed binding same texture to another block with a different block, and it doesnt do it, so it aint the texture. Any thoughts?

Posted

heu ok.. im not sure what you want to happen

 

The bricks are the block im refering to, if i place something on it, fence, wall, lever etc, it turns dark like its supposed to

so when a block has 1 side obstructed it becomes all darkened ? <- you want this ?

and when you obscure 1 side, the obscured side is the right color but not the other sides ? <- this is happening instead ?

how to debug 101:http://www.minecraftforge.net/wiki/Debug_101

-hydroflame, author of the forge revolution-

Posted

neither, the block is naturally supposed to be the darkened texture(like the texture is with the levers). But what happens is, when adding a  value of light to the 0 meta, the brick at 1 meta, gets that brightend effect, another screen to show what i mean

 

vkxKq0u.png

 

 

 

See how the brick clay bricks are different than the others(binded another block's texture to the brick texture), see the problem? I want the brick of clay in the meta not to be bright like that

Posted

is there anything that changes the meta of a block ? or it depends on how it was crafted/created

how to debug 101:http://www.minecraftforge.net/wiki/Debug_101

-hydroflame, author of the forge revolution-

Posted

well... well how can there be blocks with meta other then 0 if nothing is changing it

 

i am super confused by this ??? ??? ??? ??? ???

 

(im not accusing you btw im just really wondering how is iteven happening )

how to debug 101:http://www.minecraftforge.net/wiki/Debug_101

-hydroflame, author of the forge revolution-

Posted

you said that there wemas subblocks, i imagine youre getting those with the god mode inventory. did you check that the meta was correct upon placement ? like a println in  onBlockPlaced or something

how to debug 101:http://www.minecraftforge.net/wiki/Debug_101

-hydroflame, author of the forge revolution-

Posted

Light value code seems right.

Block with meta=0 should give light like torch, while others don't.

Note that this parameter doesn't have anything to do with how your texture look. (except that without any light, anything looks dark obviously)

Can you show us how you set your textures ?

 

 

Posted
package vanityblocks;

import java.util.List;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Icon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

public class VanityDesignblock extends Block {
public VanityDesignblock(int id) {
	super(id, Material.rock);
	setCreativeTab(vanityblocks.VanityBlocks.tabCustom);
}

/*
 * public int getLightValue(IBlockAccess world, int x, int y, int z, int
 * metadata) { if (metadata == 0) { return
 * !isActive(world.getBlockMetadata(x, y, z)) ? 1 : 15; } return 0; }
 * 
 * private boolean isActive(int blockMetadata) { return true; } old way ^
 */
/*
 * @Override public int getLightValue (IBlockAccess world, int x, int y, int
 * z) { if (world.getBlockMetadata(x, y, z) == 0) { return lightValue[15]; }
 * return super.getLightValue(world, x, y, z); }
 */
/*
 * @Override public int getLightValue(IBlockAccess iba, int x, int y, int z)
 * { int meta = iba.getBlockMetadata(x, y, z); if (meta == 0) { return 15; }
 * if (meta == 1) { return 0; } return 0; }
 */
@Override
public int getLightValue(IBlockAccess world, int x, int y, int z) {
	if (world.getBlockMetadata(x, y, z) == 0) {
		return 15;
	} else {
		return 0;
	}
}

@Override
public float getBlockHardness(World par1World, int par2, int par3, int par4) {
	int metadata = par1World.getBlockMetadata(par2, par3, par4);
	if (metadata == 0)
		return 1.5f;
	return 2f;
}

private Icon[] iconBuffer;

@Override
public void registerIcons(IconRegister par1IconRegister) {
	iconBuffer = new Icon[2];

	iconBuffer[0] = par1IconRegister.registerIcon("vanityblocks:lavaanim");
	iconBuffer[1] = par1IconRegister.registerIcon("vanityblocks:claybrick");
}

@Override
public Icon getIcon(int side, int metadata) {
	if (metadata == 0) {
		return iconBuffer[0];
	}
	if (metadata == 1) {
		return iconBuffer[1];
	}
	return blockIcon;
}

@Override
public int damageDropped(int metadata) {
	return metadata;
}

@SideOnly(Side.CLIENT)
public void getSubBlocks(int par1, CreativeTabs tab, List subItems) {
	for (int ix = 0; ix < 2; ix++) {
		subItems.add(new ItemStack(this, 1, ix));
	}
}
}

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.