Jump to content

Recommended Posts

Posted

Hi all,

 

Im having issues with my blocks and lighting, the problem being that I have a block that as it grows using updateTick() it goes up through its meta blocks, so starts at meta 0 and goes up to 5. When its meta 0-4 the light value is 1 when it is meta 5 its light value is 2, ive done this via:

 

public int getLightValue(IBlockAccess world, int x, int y, int z) 
    {
    	this.setLightValue(world.getBlockMetadata(x, y, z) == 4 ? 2 : 1);
        return lightValue[blockID];
}

 

but when the block hits meta 5 I get a nasty shadow appear under the block and another side effect being that the light source for this block seems to move on me relogging.... and by that I mean I can break the block in the night and it still be lit up, I then need to place blocks around to find the source and kill it. (leftover TE?) what am I missing? Ill grab a pic if people need it.

Posted

Hi

 

Some background information on lighting here

http://greyminecraftcoder.blogspot.com.au/2013/08/lighting.html

 

Your world.getBlockMetadata(x, y, z) == 4 ? 2 : 1 doesn't appear to match your description.. >= 5 ? 2 : 1 perhaps?

 

I think you don't need to use setLightValue at all.  Vanilla only uses it to tell whether a block is glowing (>=1) or not (==0).  getLightValue is called whenever vanilla needs to know the strength of the blocklight.

 

Instead, just return world.getBLockMetadata(x,y,z) >= 5 ? 2 : 1

 

-TGG

Posted

yeah i got my numbers wrong, the post is correct. Straight returning the check as per above does not work i end up with no light emitted.

 

So has anyone got meta block based lighting working when the block updates itself, i.e im not placing separate meta ID blocks, block 0 updates itself to block 1 updates to 2, 3 and finally4 where i want the light to be a different strength.

Posted

Hi

 

Straight returning the check as per above does not work i end up with no light emitted.

 

Perhaps I should have been more explicit - you will need to

Block.setLightValue(1.0F) at least once when you construct the block instance, for example like BlockGlowstone. 

 

public static final Block glowStone = (new BlockGlowStone(89, Material.glass)).setHardness(0.3F).setStepSound(soundGlassFootstep).setLightValue(1.0F).setUnlocalizedName("lightgem").setTextureName("glowstone");

 

There is no need to set it every time in your getLightValue method.

 

Try changing the block metadata using

 

World.setBlock(int x, int y, int z, int newBlockID, int newMetadata, int flags)

 

where flags is 2 + 1

 

-TGG

 

Posted

Edit - ignore im being an idiot. The help text on this method is really wrong...

 

ok so, is there an issue with really low level light, like using 10+ in setLightLevel when i place 4 blocks next to each other in a 2x2 the middle goes dark...

 

edit - ok now its not....what the hell is going on with my lighting...

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

    • I tried do download the essential mod to my mod pack but i didnt work. I paly on 1.21 and it should work. I use neoforge for my modding. The weird things is my friend somehow added the mod to his modpack and many others that I somehow can´t. Is there anything i can do? 
    • Thanks, I've now installed a slightly newer version and the server is at least starting up now.
    • i have the same issue. Found 1 Create mod class dependency(ies) in createdeco-1.3.3-1.19.2.jar, which are missing from the current create-1.19.2-0.5.1.i.jar Found 11 Create mod class dependency(ies) in createaddition-fabric+1.19.2-20230723a.jar, which are missing from the current create-1.19.2-0.5.1.i.jar Detailed walkthrough of mods which rely on missing Create mod classes: Mod: createaddition-fabric+1.19.2-20230723a.jar Missing classes of create: com/simibubi/create/compat/jei/category/sequencedAssembly/JeiSequencedAssemblySubCategory com/simibubi/create/compat/recipeViewerCommon/SequencedAssemblySubCategoryType com/simibubi/create/compat/rei/CreateREI com/simibubi/create/compat/rei/EmptyBackground com/simibubi/create/compat/rei/ItemIcon com/simibubi/create/compat/rei/category/CreateRecipeCategory com/simibubi/create/compat/rei/category/WidgetUtil com/simibubi/create/compat/rei/category/animations/AnimatedBlazeBurner com/simibubi/create/compat/rei/category/animations/AnimatedKinetics com/simibubi/create/compat/rei/category/sequencedAssembly/ReiSequencedAssemblySubCategory com/simibubi/create/compat/rei/display/CreateDisplay Mod: createdeco-1.3.3-1.19.2.jar Missing classes of create: com/simibubi/create/content/kinetics/fan/SplashingRecipe
    • The crash points to moonlight lib - try other builds or make a test without this mod and the mods requiring it
    • Do you have shaders enabled? There is an issue with the mod simpleclouds - remove this mod or disable shaders, if enabled  
  • Topics

×
×
  • Create New...

Important Information

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