Posted December 13, 20159 yr I'm trying to make a block that, depending on its metadata, can have any light level from 0 to 15. Since each of these blocks can have a different light level, I figure I need a tile entity. But how can I make the tile entity set the light level properly? I've tried using World#setLightValue(), but that doesn't seem to have any effect, even if I add a call to World#updateLightByType() after it. How can I make this work properly? (Also, do I even need a tile entity for this, or is there a more efficient way of handling it?) Here's the tile entity's code: package com.IceMetalPunk.weatherworks; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.EnumSkyBlock; public class TileEntitySunstone extends TileEntity { private int metaData=0; @Override public void updateEntity() { if (this.worldObj.isRemote) { return; } int thisMeta=this.worldObj.getBlockMetadata(this.xCoord, this.yCoord, this.zCoord); if (thisMeta!=this.metaData) { this.worldObj.setLightValue(EnumSkyBlock.Block, this.xCoord, this.yCoord, this.zCoord, thisMeta); this.worldObj.markBlockRangeForRenderUpdate(this.xCoord-thisMeta, this.yCoord-thisMeta, this.zCoord-thisMeta, this.xCoord+thisMeta, this.yCoord+thisMeta, this.zCoord+thisMeta); this.worldObj.updateLightByType(EnumSkyBlock.Block, this.xCoord, this.yCoord, this.zCoord); this.metaData=thisMeta; } } } Whatever Minecraft needs, it is most likely not yet another tool tier.
December 13, 20159 yr You shouldn't need a TileEntity nor to set the light value, just use the method added by Forge that gives you the world and coordinates: public int getLightValue(IBlockAccess world, int x, int y, int z) { int meta = world.getBlockMetadata(x, y, z); return value based on metadata; } http://i.imgur.com/NdrFdld.png[/img]
December 13, 20159 yr Author >_< Of course it's that simple... I didn't even know that method existed. Sorry for my noobishness, but thank you for the help! Whatever Minecraft needs, it is most likely not yet another tool tier.
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.