Stopped players from placing blocks on their heads

This commit is contained in:
Dizigma 2015-07-06 18:31:13 -06:00
parent 6f8ef4e15a
commit 5c1512d527

View File

@ -150,6 +150,15 @@ namespace TrueCraft.Core.Logic
}
}
// Prevent the user from placing blocks on themselves
var userPlayer = user.Entity as PlayerEntity;
if (userPlayer != null){
if (new BoundingBox(userPlayer.Position, userPlayer.Position + userPlayer.Size)
.Intersects(box)){
return;
}
}
// Place block
world.SetBlockID(coordinates, ID);
world.SetMetadata(coordinates, (byte)item.Metadata);