Jump to content

[Solved] [1.7.10] Different light levels per block?


IceMetalPunk

Recommended Posts

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.

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.