Jump to content

Issue with metadata and getLightValue


Anarchysage

Recommended Posts

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?

Link to comment
Share on other sites

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-

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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-

Link to comment
Share on other sites

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-

Link to comment
Share on other sites

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 ?

 

 

Link to comment
Share on other sites

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));
	}
}
}

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Slot Bank BNI adalah pilihan tergacor untuk memulai bermain slot judi Online dimuka bumi saat ini. Jika anda mempunyai Bank BNI, Anda berkesempatan mendapatkan Akun Pro atau ID pro untuk bermain slot. Tunggu apa lagi? Segera daftarkan diri anda sekarang dan dapatkan kemewahan menang maxwin di Museumbola.
    • Halo para penggemar slot online! Apakah Anda mencari pengalaman bermain slot yang seru dan menguntungkan? Apakah Anda ingin menikmati slot gacor dari server Thailand sambil melakukan deposit melalui Mandiri dengan kesempatan meraih kemenangan besar? Anda telah sampai di tempat yang tepat! Kami di WINNING303 siap memberikan Anda pengalaman bermain yang mengasyikkan dan menguntungkan. Mengapa Memilih WINNING303? WINNING303 telah dikenal sebagai salah satu platform terbaik untuk bermain slot dengan berbagai keunggulan yang kami tawarkan kepada para pemain kami. Berikut adalah beberapa alasan mengapa Anda harus memilih WINNING303: Slot Gacor dari Server Thailand Kami menyajikan koleksi slot gacor terbaik dari server Thailand yang pastinya akan memberikan Anda pengalaman bermain yang menarik dan menguntungkan. Nikmati berbagai jenis permainan slot dengan tingkat kemenangan yang tinggi dan jackpot yang menarik. Deposit Mudah Melalui Mandiri Kami memahami pentingnya kemudahan dalam bertransaksi bagi para pemain kami. Oleh karena itu, kami menyediakan layanan deposit melalui bank Mandiri, salah satu bank terbesar di Indonesia. Proses depositnya cepat, mudah, dan aman, sehingga Anda dapat langsung memulai petualangan bermain tanpa hambatan. Peluang Maxwin Besar Di WINNING303, kami selalu memberikan peluang untuk meraih kemenangan besar. Dengan berbagai promosi dan bonus menarik yang kami sediakan, Anda memiliki kesempatan untuk memenangkan hadiah-hadiah yang fantastis dan meraih maxwin dalam bermain slot.  
    • SLOT Ratubet77 adalah bocoran slot gacor rekomendasi dari Ratubet77 yang bisa anda temukan di SLOT Ratubet77. Situs SLOT Ratubet77 hari ini yang kami bagikan di sini adalah yang terbaik dan bersiaplah untuk mengalami sensasi tak terlupakan dalam permainan slot online. Temukan game SLOT Ratubet77 terbaik dengan 100 pilihan provider ternama yang dipercaya akan memberikan kepuasan dan kemenangan hari ini untuk meraih x500. RTP SLOT Ratubet77 merupakan SLOT Ratubet77 hari ini yang telah menjadi pilihan utama bagi pemain judi online di seluruh Indonesia. Setiap harinya jutaan pemain memasuki dunia maya untuk memperoleh hiburan seru dan kemenangan besar dalam bermain slot dengan adanya bocoran RTP SLOT Ratubet77. Tidak ada yang lebih menyenangkan daripada mengungguli mesin slot dan meraih jackpot x500 yang menggiurkan di situs SLOT Ratubet77 hari ini yang telah disediakan SLOT Ratubet77. Menangkan jackpot besar x500 rajanya maxwin dari segala slot dan raih kemenangan spektakuler di situs Ratubet77 terbaik 2024 adalah tempat yang menyediakan mesin slot dengan peluang kemenangan lebih tinggi daripada situs slot lainnya. Bagi anda yang mencari pengalaman judi slot paling seru dan mendebarkan, situs bo SLOT Ratubet77 terbaik 2024 adalah pilihan yang tepat. Jelajahi dunia slot online melalui situs SLOT Ratubet77 di link SLOT Ratubet77. DAFTAR SEKARANG DAFTAR SEKARANG DAFTAR SEKARANG
    • I am currently running the 1.20.1 Occultcraft modpack in Curseforge and am having numerous troubles making a mob farm with the apotheosis mod. When trying to modify the stats of the spawners specific stats such as the range, spawn count, and max entities reset to default after every spawn. When the spawners spawn boss mobs with certain attributes, that I'm not sure of, the building it is in explode even with mob griefing turned off. This has happened multiple times with varying sizes for the explosions. I was wonder if there is any way to disable these explosions from happening or disable boss abilities with something in the game. I also wanted to know a fix for the resetting stats on spawners and why this is happening.
    • SLOT Bank BSI adalah pilihan terbaik untuk Anda yang ingin merasakan sensasi bermain slot dengan layanan dari Bank BSI. Dengan keamanan terjamin, beragam pilihan permainan, kemudahan deposit via Bank BSI, dan berbagai bonus menarik, kami siap memberikan Anda pengalaman bermain yang tak terlupakan. Bergabunglah dengan kami sekarang dan mulailah petualangan seru Anda!    
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.