Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Blocks placed turn grass into dirt. #160

Open
MoBaT opened this issue May 25, 2013 · 2 comments
Open

Blocks placed turn grass into dirt. #160

MoBaT opened this issue May 25, 2013 · 2 comments

Comments

@MoBaT
Copy link

MoBaT commented May 25, 2013

Any block placed such as a rail block will turn the grass into dirt. This is due to the lightreduction being a value of 15 on default for blocks and this code in the grassblock.cs in Craft.Net.Data

public override void OnScheduledUpdate(World world, Vector3 position)
{
var block = world.GetBlock(position + Vector3.Up);
if (block.LightReduction > 2)
world.SetBlock(position, new DirtBlock());
else
Grow(world, position, false);
base.OnScheduledUpdate(world, position);
}

Where (block.LightReduction > 2) is always going to be true for classes inheriting the block class.

At the moment I don't understand what's the point of having an integer for the light reduction code for blocks. I can see it being easier to just use a boolean. That's my understanding from looking at the code but you might have something in mind fore the future.

@ddevault
Copy link
Owner

Water, for example, has a light reduction value somewhere in the middle. I'll look into that, though.

@lancepioch
Copy link

In Minecraft each block is inherits a light value. This determines how much light the block "naturally gives off" or reflects. Certain blocks may reduce the light by more than one.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants