Jump to content

1.16.5 - Custom Light Block is not working when using optifine


Kikoz

Recommended Posts

Hi!

I created a light emitting block which works when I'm not using optifine.

After I run it with optifine the block is not emitting any light. Could someone help me how to solve it? Thanks!

	public LightModel(Properties properties) {
		super(Properties.create(Material.WOOD)
    			.sound(SoundType.WOOD)
    			.hardnessAndResistance(3.0f,3.0f)
				.notSolid()
				);	
	this.setDefaultState(this.stateContainer.getBaseState().with(LIT, Boolean.valueOf(true)).with(WATERLOGGED, Boolean.valueOf(false)));
	}

  
    public int getLightValue(BlockState state, IBlockReader world, BlockPos pos) {
        Boolean i = state.get(LIT);   
    	
        if (i == true) {
        	return 15;
        } else {
		return 0;
    } }
    

    public ActionResultType onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
    	{
    	    if (Screen.hasShiftDown() == true) 
    	      {
    	           state = state.func_235896_a_(LIT);
    	           worldIn.setBlockState(pos, state, 10);
    	       } else {
    	    	     return ActionResultType.PASS;
        }
     }
    	 return ActionResultType.func_233537_a_(worldIn.isRemote);
    }

 

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.



×
×
  • Create New...

Important Information

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